- Home /
How do I make the objects appear again after they disappeared
How can I make the objects appear again after they get out of display like video below? ("Avoid objects" in video)
Thanks!
Answer by Digital-Phantom · Mar 29, 2015 at 12:28 PM
check this out
http://answers.unity3d.com/questions/276836/fall-off-left-side-of-screen-and-spawn-on-right.html
;)
Thanks for the answer! I posted it yesterday and as its my first project, I changed it to make it easy. Now what I want is, when one close to get out of the display, make it returns backwards. I tried to make it but since I can't use "while" loop because of crashes, when object come to X or Y end point, it changes the turn but it also turns back the first turn again.
Sample:
void update
float a = _myRigidbody.transform.position.x;
float b = _myRigidbody.transform.position.y;
_myRigidbody.velocity = new Vector2 (15, _myRigidbody.velocity.y);
if (a > 20) {
GameObject.Find("Coin").transform.position = new Vector2(a-1,b);
myRigidbody.velocity = new Vector2(15, _myRigidbody.velocity.y);
}
Your answer
![](https://koobas.hobune.stream/wayback/20220613191523im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Convert r2d.position.x to Pixels UnityScript 0 Answers
How to create a hero's range of action? 0 Answers
How to use tilemaps? 0 Answers
Rectangular Cube is sinking in floor rotating at 90 degree 0 Answers