Question by
kingcraft1225 · Apr 14, 2017 at 10:13 AM ·
moving-animations
script movement unity 2d
`I tried to write the code for the moving of my person of Unity 2D version 5.6 but I get this error. you know help me? sorry for my English [RequireComponent (typeof (Rigidbody2D))] public class PlayerMovement : MonoBehaviour {
Rigidbody2D body;
//Variabili upgradabili
float moveSpeed - 3f;
// Use this for initialization
void Start () {
body - GetComponent<Rigidbody2D> ();
}
// Update is called once per frame
void Update () {
Movement ();
}
void Movement()
(
float h - Input.GetAxis(" Horizontal ");
Vector2 AudioVelocityUpdateMode = new Vector2(Vector2.right.x " MoveSpeed " h, body.velocity.y);
body.velocity = velocity;
)
}
Comment
Answer by Cuttlas-U · Apr 14, 2017 at 01:01 PM
hi; u need to attach a RigidBody2D component in inspector to this object that this script is attached to ;
Answer by kingcraft1225 · Apr 14, 2017 at 03:46 PM
please would you give me the code Done Already? There are expert in these things