Hello,
I bought a new Toolkit 2D so I don't know everything.
I am making jumping game and I have a problem.(I am using Unity 4 and 2D Toolkit.) I want to acceleration x axis on character.Normally function is running in Unity but if I use 2D Toolkit is not running.Character is a sprite.Acceleration code is attached in character.
Here is the code:
public float speed = -10.0F;
private Vector3 dir;
void Update () {
Vector3 dir = Vector3.zero;
dir.x = -Input.acceleration.x;
dir.z = 0;
if (dir.sqrMagnitude > 1)
dir.Normalize();
dir *= Time.deltaTime;
transform.Translate(dir * speed);
Debug.Log(dir.x);
}