How to move objects away from screen
Hello! I'm new to coding C# in Unity!
I need to create a function called MoveAway. What I want to achieve with this function is this:
When MoveAway() triggers, any object that is inside the screen will move outwards depending on where it currently is on the screen.
For example:
If the object is closer to the upper edge of the screen than the right edge, then move up
If the object is closer to the right edge than the bottom edge, then move right,
etc etc.
Any help would be appreciated!
Answer by tormentoarmagedoom · May 20, 2019 at 09:53 AM
Hello.
Its hard to give you an answer with 0 information...
Is a 2d game? 3d? Orthgraphic camera?
Are the objects images? or GameObjects?
And the solutiuon... Just change the position of all the objects... where is the problem?
IF you dont know how to preceed, maybe its to early for you to do this. Go learnscripting, Unity basiocs. Spend 1 week watching tutorials, trying htings, commenig little projects following youtube videos, etc..
Then come back to this
Bye!