I experience problems using the color method to change the color a GUITexture
I have a GUITexture based on a png with pure {RGBA(1.000, 0.000, 0.000, 1.000)}
In my script I want to change this one to green by using
public var Display : GUITexture;
function Start()
{
Display.color = Color.green;
}
The GUITexture is assigned via the inspector (drag and drop a single png file). The original png file is a single square with the color rgb(255, 0, 0).
On the debugger I can see before executing this line
MyTexture.color is {RGBA(1.000, 0.000, 0.000, 1.000)}
color.green is {RGBA(0.000, 1.000, 0.000, 1.000)}
After execution I get:
MyTexture.color {RGBA(1.000, 0.922, 0.016, 1.000)}
If I change the color of the texture in the Inspector in the GUITexture I have similar effects the color set is not the color on screen. The same applies also if I want to manipulate the color of a SpriteRenderer object.
My assumption is that the initial color of the png still effects this setting. Is this intended behavior?
How can I apply a color to a GUITexture without this effect?
This is the only instance and it is used once and accessed from any other object.
Thanks for the initial feedback. I have edited the post: - added the assignment (drag&drop via the inspector) - Multiple access can be eliminated
– Thomas_KWhen I execute your code and then do a Debug.Log of Display.color, I get: RGBA(0.000, 1.000, 0.000, 1.000) ...as expected. So something else is going on. Can you create a small package of this behavior and put it on the net and attach a link to your question?
– robertbu