Hi, I have a few thousand static environment objects in a scene (variation of 15 objects randomly distributed). They have colliders, LODs and the lighting has been baked. Someone mentioned I should look into ECS to see if I can get a performance improvement on this. Can ECS help in this particular case? If so, how can these objects maintain the baked lighting if they are dynamically instantiated via ECS at runtime? Is this even something I should be pursuing? thanks in advance
Few thousand static objects and colliders, won't be an issue for classic OOP approach. Test it, profile it, bring results.
I'm no expert, but Antypodish has a valid point, it isn't usually a good idea to pre-optimize. That said, I don't think you would be able to use baked lighting in this case, at least not for the objects you convert to ECS. But if these are static objects, it likely doesn't matter, especially if they are not running any code themselves.
ECS is great for when you have thousands of dynamic objects that need to move around at runtime. With static objects, ECS is not really needed. In fact, for static objects, you will probably be better off simply marking them as static.
DOTS does enable a new technique one used by ECS sub scenes that can make scenes with tons of static stuff load really fast, but that entails fairly major refactoring, and for just a few thousand I'm thinking not at all worth it. Basically the approach is leverage native collections to save scene data via raw pointers to disk. So scene loading is load raw pointer data straight into ECS without any conversion/seralization needing to happen. It scales very well for huge scenes but a few thousand really isn't that much so the bang for buck likely just isn't there.