- Home /
Random Range on the X Axis
Hey guys! This is my code: clickButton.GetComponent ().localPosition = new Vector3 ((Random.Range (-12.0F, 12.0F)) * 0.5f, Random.Range (-10.0F, 10.0F), clickButton.position.z);
This is what im trying to do: I have an UI image that i want randomally move on my screen everytime i click on it. Right now what I have is that The image moves on the X Axis between 12 to -12, and on the Y Axis between 10 to -10.
I want to change that, I want to move the image like in the image and not like I explained to you earlier.. I want to move the image on the X Axis between 6 to 12 and between -6 to -12. For an example: Random.Range (-6.0F, -12.0F) AND Random.Range (6.0F, 12.0F) BOT IN THE SAME X aXIS SCRIPT. This is an image for demonstration:
Thanks in advance
Your answer
