Reputation: 45
I need to find the position of an object every 3 seconds. This code constantly gets the position of the object. What am I doing Wrong?
function checkpoint (){
last_checkpoint_X = player.transform.position.x;
}
function Update(){
InvokeRepeating("checkpoint", 10, 3.0);
}
Upvotes: 0
Views: 661
Reputation: 7236
It looks like you're trying to use the Unity3D MonoBehaviour.InvokeRepeating
function. Try this:
function Checkpoint () {
Debug.Log("repeating the Checkpoint function");
}
InvokeRepeating("Checkpoint", 10, 3.0);
Let us know if you get that message in your logs every 3 seconds.
Upvotes: 1