Hi,
I face an issue with Addcomponent : I have a gameobject named cube and I would like to attached a script named mousecontroller.
In a script named MapGeneration, I tried cube.AddComponent(mousecontroller) but it recognizes mousecontroller as a classe and tells me that it’s not valid in ths context.
The closer command i have found is cube.AddComponent(typeof(mousecontroller)) but it creates only the component without assigned my script
Thanks by advance.