Quantcast
Channel: Questions in topic: "attach"
Viewing all articles
Browse latest Browse all 168

How attach C# script by argument?

$
0
0
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.

Viewing all articles
Browse latest Browse all 168

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>