Error CS0246: MonoBehaviour' could not be found

Does anybody know how to fix this

You are likely missing the “using namespace” line. Add the line starting with “using …” shown below just above the class declaration line as shown in the example below. The UnityEngine namespace contains the MonoBehaviour class so it needs to be imported before you can use that class in your own code.

using UnityEngine;

public class MyNwBhvr : MonoBehaviour
{
}

Thanks

Also could you possibly of deleted itself or is that like impossible

And there was more I remember that was like using collections do I still need that

  • I havent had my code delete itself yet :slight_smile: so I guess the lines got removed somewhere along the way when you were editing the file.
  • The lines importing the collections namespace can be ignored/left out if you are not using anything from there . I dont think this code is using anything from them so it should be fine to leave them out.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms