Not moving,please help

This is my first code,i didnt program in unity before:

public class miscare : MonoBehaviour {
    float speed = 10.0f;

	// Use this for initialization
	void Start () {
        
	}
	
	// Update is called once per frame
	void UpdateFixed () {
        Rigidbody2D myRigidbody = GetComponent<Rigidbody2D>();
        if (Input.GetButton("Horizontal"))
            myRigidbody.AddForce(Vector2.right * speed);
        
	
	}
}

The square isnt moving,no errors.
Please help

The obvious issue is that “UpdateFixed” method should be “FixedUpdate”. Beyond that, you probably don’t want to call GetComponent in FixedUpdate. Though it’ll work, it’s very inefficient. You should make that call in Start (or Awake) and use the cached reference in FixedUpdate.