I am not native, so I might write strange English. sorry.
I want to attach the script chosen by argument to GameObject.
Example, when argument = "test1" , I want to attach "test1.cs". when argument = "test2" , I want to attach "test2.cs".
I tried this
__*public void ScriptAttacher(string StringArgument){
GameObject obj = GameObject.Find("objectName");
obj.AddComponent<StringArgument>();
}*__
but it didn't work.
How can I implement this function?
thank you.
↧