I’m trying to add a Rigidbody2d component to an Object, in code, and I’m getting this error:
The type or namespace name `Rigidbody2d' could not be found. Are you missing an assembly reference?
This is my code:
Rigidbody2d myRigidbody = gameObject.AddComponent<Rigidbody2d>() as Rigidbody2d;
These are my using directives:
using System.Collections; using System.Collections.Generic; using UnityEngine;
I’m using Unity 5.6.1f1