0

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
Benjamen Kuhman
  • 240
  • 4
  • 15
  • 1
    How have you installed that package? Nuget? Check the References in Solution Explorer, make sure the corresponding dll file is there. – Andrew Sep 15 '20 at 05:38
  • Try setting the 3rd dll lactation to the Plugins folder – Vince Sep 15 '20 at 06:00
  • Do you have the [Cinemachine Package installed via the PackageManager](https://docs.unity3d.com/Packages/com.unity.cinemachine@2.3/manual/CinemachineGettingStarted.html#installing-cinemachine)? – derHugo Sep 15 '20 at 07:26

4 Answers4

3

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

yobo zorle
  • 348
  • 3
  • 8
1

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.

Benjamen Kuhman
  • 240
  • 4
  • 15
1

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.

0

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.

wen
  • 1