Can't add script to anything.
Ok so I just started with Unity like 3 days ago and I was following tutorials. Everything was great until today when i made an Empty Object and end a C# Script and tried to add it to the Empty Object. Unity gave me this message:
Can't add script behaviour AssemblyInfo.cs. The script needs to derive from MonoBehaviour!
I looked Google and a lot of people have the same problem, aparently, but i tried everything and nothing helped.
Yes, i'm using Visual Studio, and no, it's not the Miscelaneous files problem.
Yes, the file name and the class name are the same.
And I tried to restart Unity, Visual Studio and the PC and the problem persists.
Also, i tried making the script from scratch and nothing. I tried to add other scripts to the Empty Object and it basically gives me the same error everytime, even with scripts I'm already using.
What can I do? It looks like a Unity bug for me, but I dont want to trash out all those days of work since is my first project.
Help D':
Answer by Mokomaki · Oct 05, 2019 at 01:38 PM
In order to add a script to an gameobject it has to derive from MonoBehaviour
public class AssemblyInfo : MonoBehaviour
{
Hope this helps :)
Your answer
Follow this Question
Related Questions
GameObject array not showing on the inspector 0 Answers
Debug.Log not working 1 Answer
error CS1525: Unexpected symbol Void 0 Answers