To add a script to a game object just use AddComponent:
var script : MyScript;
script = gameObject.AddComponent (MyScript);
Replace MyScript with the name of a script you want to attach.
↧