PierBJX
PierBJX

Reputation: 2353

Unity - type name 'Rigidbody2D' could not be found in the namespace 'UnityEngine' after upgraded project

I just started Unity and I am following a tutorial on Youtube. Everything was working fine until I upgraded my project from 2018.4.13f1 to 2018.4.14f1. And now, I have an error with Rigidbody2D:

The type name 'Rigidbody2D' could not be found in the namespace 'UnityEngine'. This type has been forwarded to assembly 'UnityEngine.Physics2DModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' Enable the built in package 'Physics 2D' in the Package Manager window to fix this error.

So, following some similar errors, I deleted the Packages folder. However, now I still have an error but a bit different:

The type name 'Rigidbody2D' could not be found in the namespace 'UnityEngine'. This type has been forwarded to assembly 'UnityEngine.Physics2DModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' Enable the built in package 'Physics 2D' in the Package Manager window to fix this error.

Here is my code:

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[RequireComponent(typeof(Rigidbody2D))]
public class TapController : MonoBehaviour
{

}

Upvotes: 4

Views: 8991

Answers (3)

user17830140
user17830140

Reputation: 1

I also encountered this problem today. I found that my problem was that the license was not set. I set a personal license, and that resolved the error.

Upvotes: -2

pavan kumar
pavan kumar

Reputation: 575

Visual Studio Editor Package version Update from the Unity Package Manager for a better Visual Studio integration.

Upvotes: 0

FearlessHyena
FearlessHyena

Reputation: 4095

You might just be missing that package in your project

Just import it by going top File Menu in Unity and selecting Window -> Package Manager

Then search for Physics 2D and make sure that it's enabled

enter image description here

Upvotes: 3

Related Questions