Search Unity

GUI Texture Appear

Discussion in 'Immediate Mode GUI (IMGUI)' started by AbirBK, Apr 15, 2014.

  1. AbirBK

    AbirBK

    Joined:
    Feb 14, 2014
    Posts:
    21
    Hello !
    i wanna make a GUI Texture appear when i get into a trigger, i have already made it someday, now i wanna make it work again in my project but it doesn't work, here is the script applied to the object that the player needs to collect, the start method and the OnTriggerEntry work perfectly, the problem is with th OnTriggerExit method, the GUI Texture doesn't want to disappear ! what should i do , please i have only one day to fix this problem ! HELP !

    Code (csharp):
    1.  
    2. #pragma strict
    3.  
    4. var CUTE : GUITexture;
    5. function start()
    6. {
    7.     CUTE.enabled = false;
    8. }
    9.  
    10.  
    11. function OnTriggerEnter(otherObj: Collider){
    12.  
    13.     if (otherObj.tag == "Player")
    14.     {
    15.         Debug.Log("hello");
    16.         CUTE.enabled = true;
    17.     }
    18. }
    19.  
    20. function OnTriggerExit(otherObj: Collider){
    21.  
    22.     if (otherObj.tag == "Player")
    23.     {
    24.         Debug.Log("hello");
    25.         CUTE.enabled = false;
    26.     }
    27. }
    28.  
    29.  
    30.  
     
  2. sebrobitaille

    sebrobitaille

    Joined:
    Mar 9, 2013
    Posts:
    65
    Code looks fine to me, is the debug log printing out for the on trigger exit?
     
  3. wondyr

    wondyr

    Joined:
    Nov 30, 2013
    Posts:
    36
    First is your GUITexture already defined? Second, I noticed you are using the same debug.log print out. This could lead to mass confusion if you use the same debug.log for every entry making you have to rescan all locations with it.