Answers for "what is transform.position in unity"

C#
14

unity set position

// To set the position of a gameobject use the following
GameObject.transform.position = new Vector3(x, y, z);
Posted by: Guest on February-22-2020
0

what is transform.position in unity

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);
Posted by: Guest on October-29-2020

C# Answers by Framework

Browse Popular Code Answers by Language