I want a timer to start when the player moves on either x or z. How can I do that with character controller?
Cache their starting position, then check if their current position is equal to that starting position.
If not, then the player has moved:
public class Example : MonoBehavior {
Vector3 startPosition;
void Awake() {
startPosition = transform.position;
}
void Update() {
if(transform.position != startPosition) {
//GameObject has moved.
}
}
}