I have a monobehaviour script. I attempt to add it to a gamobject and I get this dialogue
> Can't add script component 'MyScript' because the script class cannot be found. Make sure that there are no compile errors and that the file name and class name match.
The usual issue is that the filename and classname do not match or there are compiler errors. This is not the case. I've diagnosed the issue as being related to the namespace. For whatever reason if the class is inside a namespace unity will not be able to find it.
I've tried renaming the namespace but that did not work. It seems to be just namespaces in general. This issue seems to be with just this class as well. I just finished a big refactor of my project and other monobehaviours attached to gameobjects are working fine.
Any clue as to why this is happening? How exactly does unity find classes?
Thanks
> Can't add script component 'MyScript' because the script class cannot be found. Make sure that there are no compile errors and that the file name and class name match.
The usual issue is that the filename and classname do not match or there are compiler errors. This is not the case. I've diagnosed the issue as being related to the namespace. For whatever reason if the class is inside a namespace unity will not be able to find it.
I've tried renaming the namespace but that did not work. It seems to be just namespaces in general. This issue seems to be with just this class as well. I just finished a big refactor of my project and other monobehaviours attached to gameobjects are working fine.
Any clue as to why this is happening? How exactly does unity find classes?
Thanks