title: How to do rb.AddForce but for 2D? Unity C#
body: <p>I am making a 2D game where you control a shield and you have to block falling obstacles from reaching base. I know that to move something you use <code>rb.addforce</code>. However, when I do the same for 2D it doesn't work. I imagine that instead of using a Vector3 you use a Vector2, but it gives me these 2 errors: <code>Assets\Movement.cs(16,25): error CS1503: Argument 1: cannot convert from 'float' to 'UnityEngine.Vector2'</code> and this one: <code>Assets\Movement.cs(16,25): error CS1503: Argument 1: cannot convert from 'float' to 'UnityEngine.Vector2'</code> for each time I write the line. Here is my full code:</p>
  <pre><code>using System.Collections;
  using System.Collections.Generic;
  using UnityEngine;
  
  public class Movement : MonoBehaviour
  {
      public Rigidbody2D rb;
      public Collider2D collider;
  
      public float moveSpeed = 0.1f;
  
      private void Update() 
      {
          if (Input.GetKey(&quot;w&quot;))
          {
              rb.AddForce(0f, moveSpeed);
              Debug.Log(&quot;w&quot;);
          }
  
          if (Input.GetKey(&quot;s&quot;))
          {
              rb.AddForce(0f, moveSpeed);
              Debug.Log(&quot;s&quot;);
          }
      }
  }
  </code></pre>