Proper way to update enemies in a large 2d level.
I have a large 2d tiled level with enemies and other sprites, whats the best way to update only the sprites that are close to the player?
Whats the most efficient way to go about this? Ive been looking around and can't seem to find anything on this.
thank you for the help! :D
Depending on how you update them and what options you have of knowing how close they are to the player I have this idea:
If you're using an Animator and enemies are not close by means of not visible by the camera, you can just configure the animator's Culling $$anonymous$$ode to either of the other two available options
Answer by xofear · Dec 06, 2016 at 01:42 AM
I'm calculating the distance from play to enemy, if the enemy is too far, deactivate the enemy.
I think I'll use a quadtree tho, because all the enemies are still updating even if they are deactivated.
I'm just curious to see what other people have done. I'm coming from objective c SpriteKit, so unity c# is very new to me.
Your answer
![](https://koobas.hobune.stream/wayback/20220612101925im_/https://answers.unity.com/themes/thub/images/avi.jpg)