Change Transform.position Unity Code Example


Example: unity c# transform position


GameObject myObject;
// Change the position of myObject like this:
myObject.transform.position = new Vector3(x, y, z);
// Change position of GameObject that this script is attatched to:
transform.position = new Vector3(x, y, z);
// Read the x, y and z positions of myObject:
Debug.Log("x : " + myObject.transform.position.x);
Debug.Log("y : " + myObject.transform.position.y);
Debug.Log("z : " + myObject.transform.position.z);

Comments

Popular posts from this blog

C Perror Example

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"