Question by
Fervore · Sep 19, 2016 at 02:34 PM ·
javascriptgui
Change gui.Texture color with key press Javascript
#pragma strict
var currentCursor : Texture;
private var pressColor = Color.green;
private var normalColor : Color;
function Start (){
normalColor = guiTexture.color;
}
function OnGUI() {
GUI.DrawTexture (Rect(Screen.width/2, Screen.height/2,64,64), currentCursor);
}
function Update () {
if (Input.GetKeyDown ("space"))
guiTexture.color = pressColor;
print ("color changed");
}
I get the texture on my screen and the print message but it won't change its colour. I tried using .png with #ffff colour for the background and .psd i don't know how to set that white color i defined in the image please help! I'm noob in scripting i design mostly.
Comment