Hello… our screen size is Android wide 3:6. We have this object that when clicked it must be changing position. This object is a plane.
here is our code for changing position
var position =Vector2(Random.Range(0,1),Random.Range(1,0));
we are not sure if we must use Vector2 and what random.range we should declare help please. thank you
Seizure
2
Watch using Random.range with int’s, the max is EXCLUSIVE see reference Random.Range
So you are going from a range of 0 to 0 on the x and y is messed up anyways with a range min of 1 and max of 0 thats at least backwards.
var randomy : int;
var randomx : int;
function Update ()
{
// do here on mouse click
randomy = Random.range(-1.5,1.5)
randomx = Random.range(-3,3)
transform.position.y = randomy
transform.position.x = randomx
}
tell me if this worked