I'm getting this error and have no idea how to fix this...

The error is: error

-CS0039: Cannot convert type UnityEngine.Rigidbody2D' to UnityEngine.Rigidbody’ via a built-in conversion

-error CS0120: An object reference is required to access non-static member`UnityEngine.Transform.rotation’

-error CS0120: An object reference is required to access non-static member `UnityEngine.Transform.position’


Note: my code worked prior to updating to unity 5.5

using UnityEngine;
using System.Collections;


 


public class AA : MonoBehaviour


{


    public Rigidbody2D projectile;


    public float speed = 20;

 


   // Update is called once per frame


    void Update()


    {


        if (Input.GetKeyDown("s"))


        {


            Rigidbody instantiatedProjectile = Instantiate(projectile, transform.position, transform.rotation) as Rigidbody;

            instantiatedProjectile.velocity = transform.TransformDirection(new Vector3(0, 0, speed));

        }


    }


}

You’re trying to instantiate a Rigidbody2D as a Rigidbody… I’m surprised that ever worked. Seeing as it looks like you’re trying to work in 3d, you need to change line 14 to reference a rigidbody instead:

public Rigidbody projectile;

Rigidbody does not inherit from Rigidbody2D so you can not implicitly convert it (nor in any other way). Rigidbody2D instantiatedProjectile = Instantiate(projectile, transform.position, transform.rotation) as Rigidbody2D; should work.