W
W
WalloutDay2016-05-15 00:01:20
Android
WalloutDay, 2016-05-15 00:01:20

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

2 answer(s)
D
DrJarold, 2016-05-17
@WalloutDay

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 ...

G
GavriKos, 2016-05-15
@GavriKos

And what is the question?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question