x


Button in GUI BeginScrollView problem

I just edited my inventory script to use the beginScrollView function. However my button to open the sub menu no longer works in it. Any ideas why? Go under assumption that all variables are defined. code:

function OnGUI() {

numberOfItems = 0;

buttonPosX = 10;

buttonPosY = 25;

if(openInventory == true)
{

   if(openSubMenu == true)
   {
     SubMenu();
   }

   //begin scroll view
   scrollVector = GUI.BeginScrollView(Rect(0, 0, Screen.width/2, 
   Screen.height/2),scrollVector, Rect(0, 0, 450, 450));

   //put stuff in scroll view
   GUI.TextArea(Rect(0,0,450,450), "INVENTORY");

   for(items in menuItems)
   {
     if(GUI.Button(Rect(buttonPosX, buttonPosY, 100, 50), items))
     {
      openSubMenu = true;
      currentItem = items;
     }

     buttonPosX = buttonPosX + 125;
     numberOfItems += 1;

     if(numberOfItems %4 == 0)
     {
      buttonPosX = 10;
      buttonPosY = buttonPosY + 115;
     }
   }

   GUI.EndScrollView();

   //GUI.Box(Rect(0, 0, Screen.width/2, Screen.height/2),"INVENTORY");
}

if(activateIW == true)
{
   GUI.Box(Rect(Screen.width - 225, 10, 215,25), "object is already in your inventory");
}

}

more ▼

asked Mar 27 '12 at 07:58 PM

Kag359six gravatar image

Kag359six
102 30 31 33

(comments are locked)
10|3000 characters needed characters left

0 answers: sort voted first
Be the first one to answer this question
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x5092
x1134
x1130
x403
x19

asked: Mar 27 '12 at 07:58 PM

Seen: 929 times

Last Updated: Mar 27 '12 at 07:58 PM