You have assigned x y z value equal to 0 and you have not applied any change to it. In Update you are Continuously passing (0,0,0).
Your code works but since the value doesnot change ,you dont see any change.
using UnityEngine;
using System.Collections;
public class Demo : MonoBehaviour {
public float x ;
public float y ;
public float z ;
// Use this for initialization
void Start () {
x=0f;
y=0f;
z=0f;
}
// Update is called once per frame
void Update () {
x += 1;
transform.position = new Vector3(x,y,z);
}
}
Now u will see it changing position.
↧