So I want to make texture smoothly invisible,
so wrote like,
public Texture2D moneyTex;
public GUITexture moneyIcon;
public float mIconSpeed = 60;
public float mIconBlurSpeed = 2;
Rect moneySize = new Rect(-61, -29, 110, 110);
Color moneyC = new Color(128f, 128f, 128f, 128f);
float y;
float b = 128f;
public bool startMoneyAnimBool;
public void ShowMoneyAnim(){ // show money icon moving
moneyIcon.texture = moneyTex;
moneySize = new Rect(-61, -29+y, 110, 110);
y += Time.deltaTime * mIconSpeed;
moneyC = new Color(128f, 128f, 128f, b);
b -= Time.deltaTime * mIconBlurSpeed;
moneyIcon.pixelInset = moneySize;
moneyIcon.color = moneyC;
if(moneySize.y > 60){
y = 0;
moneyIcon.color = new Color(128f, 128f, 128f, 128f);
moneyIcon.texture = null;
startMoneyAnimBool = false;
}
}
But when I activate this function, icon does not blur, when I checked guitexture, the color value is (32640, 32640, 32640, 32640) (r,g,b,a)
seems maximum value. Why and how to fix this?
(testes with various icon blur speed changing, but same)