Hello to everyone! I'm pretty new on scripting on C# so I've a script that isn't working still doesn't know why, any ideas? Here is the script: using System.Collections; using UnityEngine; using System.Collections.Generic; public class Movimiento2D : MonoBehaviour { private Rigidbody2D rb2d; void Start() { rb2d = GetComponent<Rigidbody2D>(); } void FixedUpdate() { float moveHorizontal = Input.GetAxis("Horizontal"); float moveVertical = Input.GetAxis("Vertical"); Vector2 movement = new Vector2(moveHorizontal, moveVertical); rb2d.AddForce(movement); } }
Please check the first post of the forum and use the formatting tags to make your code actually readable. Then please be a little more specific about "isn't working." Are there any errors? Did you put in a Debug.Log() call to see if the code runs? Is there smoke or fire pouring out of your computer? Give us some clues.
Use Debug.Log Debug.Log(moveHorinzontal) etc to check what the input values are. They are most probably too smol