Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

GUITexture.color disappear!

Discussion in 'Immediate Mode GUI (IMGUI)' started by Arnie06, Mar 13, 2011.

  1. Arnie06

    Arnie06

    Joined:
    Jan 24, 2011
    Posts:
    14
    Ok, so this is weird...

    when I apply a custom color to GUITexture it disappears from my real time view after i press play...ha, from what I understand you can change the color of a GUITexture that appears on screen with something like GUITexture.color = Color.blue. When I code something like the previous I hit the play button and it works perfectly, my little 90 x 90 GUItexture stays on screen. However, if i try and assign a color to the GUITexture using a predefined color set such as testColor via GUITexture.color = testColor, and i press the play button, my little 90 x 90 box disappears...WTH!? lol Furthermore, I know my color sets are right because it is changing the other objects i want it to change such as GameObject.renderer.material.color = testColor (so my color sets are not part of the problem...i think lol).

    Thanks in advance :D,

    Aaron
     
  2. hamidmirhadi

    hamidmirhadi

    Joined:
    Sep 16, 2014
    Posts:
    1
    Hi
    I think it's very late but today I found it.
    that is because of alpha channel of your guitexture. when you change the color the alpha sets on black and the texture disappears. you should write this line after changing color.:
    " GUITexture.Color.a = 128; "