I have a problem!

i can’t add the script to the main camera or the inspector!!!

Hi, it’s been ages since you posted this, but I’m having a similar issue - when I drag and drop the script to the main camera I get this error:
image

Did you have the same error? Any luck in fixing it?

Your script probably has some errors, according to what the message says, your script isn’t inheriting from MonoBehaviour, I can only assume what is going on without seeing the code, but this might help:

    public class YourClass : MonoBehaviour // <---Are you missing that?
    {
    }

If you are still having issues, please, copy and paste your code here, that makes helping you a lot easier.

Thanks for getting back so quick!

The class seems to be set right, here’s the code
image

Online it seems this is often because the name of the file is mismatched, but it all looks fine.

I have some errors on starting Unity which I think might be related…

Yeah, it has something to do with Unity, try re-starting Unity, if that doesn’t work try erasing the Library Folder within your project folder, re-start Unity after that.

Privacy & Terms