I periodically write massive long documents detailing all the bugs in Unity that I know, have memorized, and have to workaround on a day-to-day / hour-to-hour basis. But it makes me so angry and frustrated – so much terrible coding, so little technology-leadership at the company – that I end up deleting it. Life is too short to be daily reminded how crappy (and yet easy to fix) our tools are.
Then, every 6 months or so, when people ask me for simple examples of how ECS’s fix Unity, I have to wrack my brains for something simple.
So I’m going to start blogging simple examples as I run into them, with only enough context for me to understand them. Here’s the first…
Share a trait between AI enemies, and non-AI, unmoving, static objects
I have blobs that move and eat each other.
Now I want to add food, that cannot move, cannot eat anything, but is edible.
This is impossible in Unity without writing deliberately-bad code, for two reasons:
- Unity prevents you writing OOP code: Unity corp’s early programmers were inexperienced at programming, didn’t really understand C#, and broke it rather than work within it.
- Unity does not allow traits to be selectively shared between objects. This is the core feature of all Entity Systems, and shows beautifully why we do NOT accept any claim that “Unity is an Entity System / Component System / Entity-Component System”