Hello.
I know the standard way to add a component to a gameobject with .addcomponent().
But is it also possible to instantiate a component with a class, monobehaviour script, and add it to a gameobject.
I tried some attempts but not sucesful.
eg:
Component myComp = new Component();
//reference my script
myComp = ?
//or this worked too, forgot it's inheritance could have been :component
Component myScript = new Script_myUI_Text();
//but then didn't work
GameObject g = new GameObject();
g.addcomponent<myScript>();
How do you use the Component class?