What would be the code to clone a script from the resources folder and put it into a GameObject? I haven’t been able to find anything in the scripting reference about this.
Unity ScriptReference - AddComponent
Test->
var nameOfScript : String ; //set name in inspector
function Update(){
if(Input.GetKeyDown(KeyCode.X)){
gameObject.AddComponent(nameOfScript) ;
}
}
press X, and now you got your script added.