unity move with transform.position code example
Example 1: unity set position
GameObject.transform.position = new Vector3(x, y, z);
Example 2: unity c# transform position
GameObject myObject;
myObject.transform.position = new Vector3(x, y, z);
transform.position = new Vector3(x, y, z);
Debug.Log("x : " + myObject.transform.position.x);
Debug.Log("y : " + myObject.transform.position.y);
Debug.Log("z : " + myObject.transform.position.z);
Example 3: unity how to move character using transform
Using UnityEngine;
Using System.Collections;
public class MovementExample : MonoBehaviour
public float speed = 5f;
void update()
{
tranform.Translate(Vector3.up * Time.deltaTime * speed);
tranfrom.Translate(Vector3.forward * Time.deltaTime * speed);
}