Jahroy was very kind enough to write this script out for me.
/* an array of SearchObjects */
var searchItemList : SearchObject [];
var scrollRect : Rect = Rect(200, 200, 220, 220);
var itemRect : Rect = Rect(0, 0, 200, 600);
var buttonRect : Rect = Rect(0, 0, 200, 100);
var scrollPos : Vector2 = Vector2.zero;
/* fill the array with random stuff for testing */
function Start ()
{
searchItemList = new SearchObject [6];
searchItemList[0] = new SearchObject("Grenade");
searchItemList[1] = new SearchObject("Bunny Slippers");
searchItemList[2] = new SearchObject("Flame Thrower");
searchItemList[3] = new SearchObject("Lollypop");
searchItemList[4] = new SearchObject("Junk Pile");
searchItemList[5] = new SearchObject("Car");
}
/* draw a GUI to show what has NOT been found */
function OnGUI ()
{
scrollPos = GUI.BeginScrollView(scrollRect, scrollPos, itemRect);
var theRect : Rect = buttonRect;
/* loop through each SearchObject in the array */
for ( var thisItem : SearchObject in searchItemList ) {
/* skip items that have been found */
if ( thisItem.isFound ) {
continue;
}
/* draw a button for each SearchObject in the array */
if ( GUI.Button(theRect, thisItem.name) ) {
thisItem.isFound = true;
}
/* advance the rectangle for the next button */
theRect.y += theRect.height;
}
GUI.EndScrollView();
}
/* a definition for a simple example class named SearchObject. */
/* note that a SearchObject has a transform associated with it. */
/* you could assign something to that by dragging an object onto */
/* the appropriate slot in the inspector */
class SearchObject
{
var name : String;
var isFound : boolean;
var transform : Transform;
function SearchObject ( theName : String )
{
name = theName;
isFound = false;
}
}
While this script does do mostly what
I need. I do not know how to make is
so once the items are picked up they
are hidden/removed from the list
automatically and not by clicking the
gui button. If some one can at most
point me to the right documentation on
what I need to do, not asking someone
to re-write this. Thank you all for
your time.
var dis : int = 1;
var hit : RaycastHit;
static var items : int;
static var itemsLeft : int;
var item1 : GameObject;
var item2 : GameObject;
var item3 : GameObject;
var item4 : GameObject;
var item5 : GameObject;
var item6 : GameObject;
var item7 : GameObject;
var item8 : GameObject;
var item9 : GameObject;
var item10 : GameObject;
var item11 : GameObject;
var item12 : GameObject;
var item13 : GameObject;
var hiddenItem : GameObject;
//Pulling From Game Manager Script
var gText: GUIText; // drag the GUIText here from the hierarchy
static var item1found = false;
static var item2found = false;
static var item3found = false;
static var item4found = false;
static var item5found = false;
static var item6found = false;
static var item7found = false;
static var item8found = false;
static var item9found = false;
function Update () {
for (var touch : Touch in Input.touches) {
if (touch.phase == TouchPhase.Began) {
// Construct a ray from the current touch coordinates
var ray = Camera.main.ScreenPointToRay (touch.position);
if (Physics.Raycast (ray, hit, dis))
{
switch (hit.collider.name)
{
case "mirrior":
items += 1;
itemsLeft += 1;
iTween.FadeTo(item1,{"alpha":0, "time" : 2});
Destroy(item1,2);
item1found = true;
break;
case "hotwaterbottle":
items += 1;
itemsLeft += 1;
iTween.FadeTo(item2,{"alpha":0, "time" : 2});
Destroy(item2,2);
item2found = true;
break;
case "goldplate":
items += 1;
itemsLeft += 1;
iTween.FadeTo(item3,{"alpha":0, "time" : 2});
Destroy(item3,2);
item3found = true;
break;
case "sunglasses":
items += 1;
itemsLeft += 1;
iTween.FadeTo(item4,{"alpha":0, "time" : 2});
Destroy(item4,2);
item4found = true;
break;
case "mug":
items += 1;
itemsLeft += 1;
iTween.FadeTo(item5,{"alpha":0, "time" : 2});
Destroy(item5,2);
item5found = true;
break;
case "winebottle":
items += 1;
itemsLeft += 1;
iTween.FadeTo(item6,{"alpha":0, "time" : 2});
Destroy(item6,2);
item6found = true;
break;
case "Ipad":
items += 1;
itemsLeft += 1;
iTween.FadeTo(item7,{"alpha":0, "time" : 2});
Destroy(item7,2);
item7found = true;
break;
case "controller":
items += 1;
itemsLeft += 1;
iTween.FadeTo(item8,{"alpha":0, "time" : 2});
Destroy(item8,2);
item8found = true;
break;
case "wii":
items += 1;
itemsLeft += 1;
iTween.FadeTo(item9,{"alpha":0, "time" : 2});
Destroy(item9,2);
item9found = true;
break;
default:
Debug.Log("haha");
}
}
}
}
}
function LateUpdate()
{
var txt: String = " Items to find:
";
var count : int = 0;
if (item1found==false && count < 6)
{
count++;
txt += "Mirrior
";
}
if (item2found==false && count < 6)
{
count++;
txt += "Hotwater Bottle
";
}
if (item3found==false && count < 6)
{
count++;
txt += "Gold Plate
";
}
if (item4found==false && count < 6)
{
count++;
txt += "Pair of Oakley's
";
}
if (item5found==false && count < 6)
{
count++;
txt += "Coffee Mug
";
}
if (item6found==false && count < 6)
{
count++;
txt += "Wine Bottle
";
}
if (item7found==false && count < 6)
{
count++;
txt += "Ipad
";
}
if (item8found==false && count < 6)
{
count++;
txt += "Wii Controller
";
}
if (item9found==false && count < 6)
{
count++;
txt += "Wii System
";
}
gText.text = txt;
}