Hello, in this case, I’ve a grid of tiles generally like 64x64 (4096) and each has its own “Tile” script.
The Tile scripts are stored in a Dictionnary.
I tried many methods but no one has god performance.
Example with delegates :
At each tile that spawns I suscribe “On Update” from the Tile script to the Level.OnUpdate event, it calls OnUpdate each tick in Level.
When a Tile dies I just unsuscribe the Tile from it.
Demo :
(1min)
direct link
Edit : Thanks for all the replies, but I find a new solution : Unity - Scripting API: UnityEvent
So much faster than the delegates, and I optimized the terrain’s mesh (removed air Mesh)
I can upload a download link if someone wants to.