Answer the question
In order to leave comments, you need to log in
Unity Markers, in a 2d game?
Hi all! I have one question. The bottom line is that there are enemies in the 2d toy. View from above. So, if the enemies are outside the screen area, then along the edges of the screen, well, or around the player, there should be markers that show exactly where the enemy is flying from.
Answer the question
In order to leave comments, you need to log in
Everything is simple. Unity has OnBecameInvisible() and OnBecameVisible() methods that fire when an object leaves the camera view and enters it. You need to hang a script on your enemies where in these methods you will draw and hide markers along the edge of the camera. You already need to come up with the drawing itself, but it’s not difficult to just read the x, y position of the object and calculate the position of the marker from this data, taking into account that it is on the edge of the camera. Well, as advice in these methods, write down the functionality for unloading the scene when the object leaves it, turning off the rendering of the object and unnecessary scripts ...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question