I have a ball (Circle Collider 2D + RigidBody2D) and its rolling in my scene. However I’m unable to read the position of this ball gameobject.
I tried ball.transform.localPosition and ball.transform.position, but both only show a Vector3 (0,10,0) of the position where I instantiate the prefab. I would have expected that x is changing because the ball is rolling in the scene.
Any ideas how to get x?
Code:
Debug.LogFormat("local {0}, normal {1}", ball.transform.localPosition, ball.transform.position);
Output:
local (0.0, 10.0, 1.0), normal (0.0, 10.0, 1.0)
UnityEngine.Debug:LogFormat (string,object[])