i am making a 2d platformer in unity like mario or adventure island, and i am placing enemies manually(not doing any spawning) in the world, and those enemies have animations and movement scripts with update function.
And now my question is, how can i handle the enemies outside camera view.
I just want that the enemies should update/animate/move only when they come inside the camera view, otherwise they should be fixed where they were manually placed in the world.
Maybe not only enemies but other things like coins, stars, etc(having different animations and scripts)
Should i need to use some collision trigger, like attaching trigger to camera and detecting each enemies entered inside it and enabling animations and scripts on them.
Please tell me if that is an efficient way or if not please tell me if there is any simple and efficient way to do this.
Please correct me if there's anything wrong. Thank you.