- Home /
Inventory, why didn't work element?
Hey guys. Why didn't work element? GUI.Label (windowRect,"Heeey");
 function OnGUI()
 {
 if(ShowInventory==true){
     var texToUse : Texture;
     var currentInventoryItem : InventoryItem;
     var windowRect : Rect = Rect (60, 60, 300, 300);
      //Go through each row
      for( var i = 0; i < inventory.length; i ++ )
      {
          // and each column
          
          
          for( var k = 0; k < inventory[i].length; k ++ )
          {
              currentInventoryItem = inventory[i][k];
            
              //if there is an item in the i-th row and the k-th column, draw it
              if( inventory[i][k] == null )
              {
                  GUI.DrawTexture( new Rect( offSet.x+k*(iconWidthHeight+spacing), offSet.y+i*(iconWidthHeight+spacing), iconWidthHeight, iconWidthHeight ), emptyTex );
              }
              else
              {
                  GUI.DrawTexture( new Rect( offSet.x+k*(iconWidthHeight+spacing), offSet.y+i*(iconWidthHeight+spacing), iconWidthHeight, iconWidthHeight ), currentInventoryItem.texRepresentation );
              }
              
                 if(currentInventoryItem != null && 
                    GUI.Button( new Rect( offSet.x+k*(iconWidthHeight+spacing), offSet.y+i*(iconWidthHeight+spacing), iconWidthHeight, iconWidthHeight ), "", GUIStyle("label") ))
              {
             
              GUI.Label (windowRect,"Heeey"); // Why didn't work?
              
                  currentInventoryItem.worldObject.transform.position = transform.position;
                  currentInventoryItem.worldObject.transform.rotation = transform.rotation;
                  currentInventoryItem.worldObject.active = true;
                  
                  if(Input.GetMouseButtonUp(0))
                  {        
                      //Equip it
                      //currentInventoryItem.worldObject.transform.parent = transform;
     
                  } else if(Input.GetMouseButtonUp(1))
                  {
                      //Drop it
                      inventory[i][k] = null;    
                      currentInventoryItem.worldObject.transform.parent = null;
       
                  }
              }
             
          }
     }
 }
               Comment
              
 
               
              Answer by zwacky · Jun 11, 2011 at 08:48 PM
the GUI.Label (windowRect,"Heeey"); will only be shown when the button has been clicked (and the slot clicked has an item in it) for one frame.
so you most likely won't notice the Heeey in that short amount of time (scenes in editors can easily achieve over 100 fps)
if this didn't cover your question, then please take a little bit more time explaining it.
Thank you for answer. How can i draw element with item discription when mouse is over button or texture of current item? Thanks.
I solved problem by OurRect.Contains(Event.current.mousePosition)); Thanks one more time friend.
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                