title: C# Unity: Cannot convert method group 'GetComponent' to non-delegate type ' Rigidbody2D'
body: <p>I am new to C#/C++(Sorry if the mistake in the code is obvious.)</p>
  
  <p>I am using <a href="https://www.youtube.com/watch?v=s4ObxcdXoFE" rel="nofollow noreferrer">this tutorial</a> (1:27:47 mark) and have run into an error. I tried to fix this code by looking through the web for solutions for other people who had similar problems. When I first got this code, the error was:</p>
  
  <p><code>UnityEngine.Component' does not contain a definition for 'velocity' and no extension method 'velocity' of type 'UnityEngine.Component' could be found. Are you missing an assembly reference?'</code></p>
  
  <p>After I applied some fixes, this is what the code looks like now:</p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  using UnityEngine.UI;
  
  //This scrits makes the character move when the screen is pressed and 
  handles the jump
  public class CharacterFinal : MonoBehaviour
  {
  public bool jump = false;               // Condition for whether the player should jump.    
  public float jumpForce = 10.0f;         // Amount of force added when the player jumps.
  private bool grounded = false;          // Whether or not the player is grounded.
  public int movementSpeed = 10;          // The vertical speed of the movement
  private Animator anim;                  // The animator that controls the characters animations
  //Declare rigid2D
  Rigidbody2D rigid2D;
  // Use this for initialization
  
  void Awake()
  {
      anim = GetComponent&lt;Animator&gt;();
  
      //Initialize rigid2D
      rigid2D = GetComponent&lt;Rigidbody2D&gt;;
  }
  
  
  //This method is called when the character collides with a collider (could be a platform).
  void OnCollisionEnter2D(Collision2D hit)
  {
      grounded = true;
      print ("isground");
  }
  
  //The update method is called many times per seconds
  void Update()
  {
      if(Input.GetButtonDown("Fire1"))
      {       
          // If the jump button is pressed and the player is grounded and the character is running forward then the player should jump.
          if(grounded == true)                        
          {
              jump = true;
              grounded = false;
              //We trigger the Jump animation state
              anim.SetTrigger("Jump");
          }
  
      }
  
  }
  
  
  
  
  //Since we are using physics for movement, we use the FixedUpdate method
  void FixedUpdate ()
  {
  
      //if died that 
      rigid2D.velocity = new Vector2(movementSpeed, rigid2D.velocity.y );
      //else
      //moving
  
  
      // If jump is set to true we add a quick force impulse for the jump
      if(jump == true)
      {
          // Add a vertical force to the player.
          rigid2D.AddForce(new Vector2(0f, jumpForce),ForceMode2D.Impulse);
  
          // We set the variable to false again to avoid adding force constantly
          jump = false;
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>The error it gives is this </p>
  
  <pre><code>Cannot convert method group 'GetComponent' to non-delegate type 
  UnityEngine.Rigidbody2D'.
  </code></pre>
  
  <p>The error is on line 22</p>
  
  <pre><code>rigid2D = GetComponent&lt;Rigidbody2D&gt;;
  </code></pre>