superunitybuild / buildtool

A powerful automation tool for quickly and easily generating builds with Unity.
MIT License
1.13k stars 117 forks source link

Having trouble with custom BuildPlatforms with custom properties #139

Open 3ternal opened 1 month ago

3ternal commented 1 month ago

Hi,

A long while ago, I came across the problem of creating BuildPlatforms for consoles: https://github.com/superunitybuild/buildtool/issues/90

I was able to create my own, but now that I'm knee-deep in development, I've noticed some issues.

Some platforms have custom options that appear in the Build Settings window, like whether to create an installable ROM or a different type of output. I think it would be easier to implement these if BuildPlatform's Draw() method was virtual, right?

In my BuildSwitch script, I have a separate method that draws these extra PropertyFields. But in order to call it, I need my own version of BuildPlatformListDrawer that calls the special method after the regular Draw(). And I haven't found a way to make my platform list drawer take priority over the main BuildPlatformListDrawer.cs. Every solution that I've found involves editing the source file in some way, which means that the edit gets auto-reverted later due to the package cache.

Anyway, correct me if I'm wrong, but think the correct solution here is to just make Draw() virtual and then inherit from it.

(As an aside, I don't mind contributing my BuildPlatforms for the Switch and PS5, but I feel like we're technically not allowed to do that in a public repo. I can post something to the private forums if we come up with a non-hacky solution, though).

3ternal commented 3 weeks ago

Ended up adding this feature in a fork: https://github.com/3ternal/buildtool