title: There is no 'Rigidbody2D' attached to the "Player" game object, but a script is trying to access it. (Unity)
body: <p>I am very new to scripting in C# and I am trying to add a component to an object but I keep on getting this error:</p>
  
  <blockquote>
    <p>There is no 'Rigidbody2D' attached to the "Player" game object, but a script is trying to access it.</p>
  </blockquote>
  
  <p>This is the code I have so far:</p>
  
  <pre><code>void Start()
  {
      GameObject.Find("Player");
      gameObject.AddComponent&lt;Rigidbody2D&gt;();
      Body = GetComponent&lt;Rigidbody2D&gt;();        
  }
  
  private void FixedUpdate()
  {
      float moveHorizontal = Input.GetAxis("Horizontal");
      float moveVertical = Input.GetAxis("Vertical");
      Vector2 movement = new Vector2(moveHorizontal, moveVertical);
      Body.AddForce(movement * speed);
  }
  </code></pre>