- Home /
 
               Question by 
               Dothackking · Jul 17, 2013 at 07:14 PM · 
                c#guiinventory  
              
 
              GUI not working correctly? (Double tooltip display)(c#)
Okay, I HATE GUI coding. It makes VERY little sense to me, so PLEASE tell me what I"m doing wrong :(
If you hover over the first item in the array with 2 items in it (haven't tried with more) it gives you double the tooltip, but the second item in the array works properly.

     void OnGUI()
     {
         
         if(inventoryOpen)
         {
         int invcount = 0;
         GUI.BeginGroup (new Rect(Screen.width/2 +100, Screen.height - 200, 400, 100));
         GUI.Box (new Rect(0,0,400,100), "Weapons");
         foreach(GameObject inv in inventory)
             {
             if(invcount < inventory.Count)
                 {
                     invcount ++;
                 }
             if(GUI.Button (new Rect(10 + (invcount - 1) * 65,20,60,60),new GUIContent(inv.name, "Damage: " + inventory[invcount-1].GetComponent<Item>().dmg)))
                 {
                     Debug.Log ("equipping" + inv.name);
                     //Write this later
                 }
             GUI.Label (new Rect(10 + (invcount - 1) * 65, 70, 100, 30), GUI.tooltip);
             }
         
         GUI.EndGroup();
         }
     }
 
                 
                inverror.png 
                (95.0 kB) 
               
 
              
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by perchik · Jul 17, 2013 at 07:55 PM
Try adding GUI.tooltip = null; after the GUI.Label that shows the tooltip 
Your answer
 
 
             Follow this Question
Related Questions
Is there any easy way to keep buttons inside of box? (c#) 1 Answer
How to dynamically change the text in Unity(Augmented Reality + NYARtoolkit(C#)) ? 0 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Passing gameObjects to Another Script: NullReference Exception 1 Answer
 koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                