Array

I have 8 pieces of geometry, which basically have the same code on them, named Link1->Link8.

http://forum.unity3d.com/viewtopic.php?t=6473

function OnMouseUp(){
var go = GameObject.Find("Link1");
go.GetComponent("LoadParentFrameFunction").enabled = false;
}

Could I, instead of duplicating the script 8 times correcting the GameObject name, use an array for this, so it runs the script for each object?

function OnMouseDown(){
if(enabled){var go = GameObject.Find("Main Camera");
go.GetComponent("MouseLook").enabled = false;
Application.ExternalCall("parent.showHideText", "address1");
}
}

Also this script is basically the same for all 8 objects, only the string in ExternalCall is different from the 8 objects.

I have never used array (or programmed much entirely), so any help would be highly appreciated.

If its an string you can create a variable

var address : String;

That will be visible in the editor so you can edit there what you want to execute for each object that has the script with:

function OnMouseDown ()
{
   if(enabled)
   {
      var go = GameObject.Find("Main Camera");
      go.GetComponent("MouseLook").enabled = false;
      Application.ExternalCall("parent.showHideText", address);
   }
}

You can have as many variables you want to be editable right in the editor inspector.

Note that this variables are not private and must be outside of every function.

.ORG