Hey Guys,
BLUF: How effective at optimization is deactivating game objects with setActive when dealing with LOTS of game objects in a scene but when you only need a few available to the player at any one time?
I'm a new game coder, and by new I mean messing around for years but only getting marginally better
So I am creating a game that has a rather large amount of tiles. A wilderness game where you hunt and trap animals and just sort of live outside. I know, so unique right? After reading up it sounds like the best way to do this is to not have individual object tiles and rather have a single plane sharing a mesh and designate the tiles via code. I went through a few tutorials on this (quill18creates was one).
That's all well and good, but I haven't been able to get the functionality out of the tiles I want that way, usually because most tutorials stop after texturing them and coding movement of units, but almost never go into adding functionality to the tiles themselves. In any case I am back to using objects.
So my real question is if I use blocks of tiles, say 100x100, and give them a collider the equivalent of 10 tiles around this block which sets the block of tiles active when the player enters the collider area and deactivates it when the player leaves, will this effectively lower the resource drain of all these tiles? Note I don't want to constantly create and destroy blocks because the player can modify the terrain and whatnot. Though I suppose I can allow the destruction and reload if nothing has been altered on that block.
My understanding is that when you use setActive() to deactivate a game object most of the system resources it uses with its scripts and renderers and especially updates do not take place. Would this bee enough to allow a world that is many thousands of tiles?