Namespace name "Cinemachine" could not be found

10.4k Views Asked by At

This is my code in my project

using UnityEngine;
using Cinemachine;

public class CameraCollider : MonoBehaviour {

    public void OnTriggerExit(Collider other) {
        Debug.Log("Test");
    }
}

I am using the Cinemachine Package. This is the error I get:

Assets\Scripts\CameraCollider.cs(2,7): error CS0246: The type or namespace name 'Cinemachine' could not be found (are you missing a using directive or an assembly reference?)

So far I've tried

  • Reinstalling Rider
  • Deleting Rider files in the project directory
  • Deleting .idea files
4

There are 4 best solutions below

0
On

This ended up being an easier fix than I expected. The problem ended up being that the developer that I'm working with had created an assembly file that I didn't know existed. So I just had to add Cinemachine to that assembly file in the scripts folder.

0
On

Go to Windows >> Package Manager >> on Packages (Select Unit Registry) >> Search "Cinemachine" >> Install & Import enter image description here

0
On

I had the same issue. Turns out that in Assets foler there is an asmdef file I imported from previous project. Deleting that file solved all for me.

0
On

I had this issue after installing Bolt for easy unity backups. Though the error was not preventing the script from compiling and all features functioned as expected during gameplay seeing a red line in my code was unacceptable.

The fix I came to was: In visual studio click project and add reference. This will open the reference manager. On the left tab click Projects and then click the checkbox next to each of the items marked as a "Cinemachine", there are three of them at this time. Press okay button.

Result: Visual basic will recognize the cinemachine namespace and will no longer highlight it as an error.