Hi, I have a level with many gameobjects, but I would to have not all gameobjects in the scene because prestations. But that they spawn on a moment that my player comes near to it. How do i do this? Thanks, Sam
You can set up an isTrigger collider and when the player walks into it, have it spawn the enemies within that collider. You can use an OnTriggerStay2D() function to detect your enemy spawn zones within the collider and the enemies will appear only while the player remains inside. You can design a file to save enemy states/position and store the information when you leave the collider with OnTriggerExit2D(). Then when you walk back into the collider, access your file and everything will be as it was when you left.