Tasharen Entertainment Forum

Support => NGUI 3 Support => Topic started by: BurSari92 on July 27, 2013, 10:10:05 PM

Title: Changing Default-Color of an Image Button?
Post by: BurSari92 on July 27, 2013, 10:10:05 PM
Hello Community,
my problem is: I dont know how to access the Color Tint of an Image Button (from another script) to change the Default color to grey.
Script is like this example but won´t work:

public UIImageButton objAttack1; //The Image Button i want to access.

   void Start()
   {
            objAttack1.UIButtonColor.defaultColor = Color.gray   //needs to change the Default color now.
   }

Hoping for help :)
Title: Re: Changing Default-Color of an Image Button?
Post by: ArenMook on July 28, 2013, 08:38:21 AM
Image button doesn't have anything to do with colors. Do you mean a UIButtonColor script?

objAttack1.color = Color.gray; <-- changes the color immediately

objAttack1.GetComponent<UIButtonColor>().defaultColor = Color.gray; <-- default color
Title: Re: Changing Default-Color of an Image Button?
Post by: BurSari92 on July 28, 2013, 06:47:36 PM
Woow thank you very much it works now :)
But i have to change the code a little bit for that.

for coloring the Image Button i used the backgroud sprite of the Image Button:

public UISprite objSprite;

   void AttackButton1()
   {
      objSprite.color = Color.gray;
   }

and now it works thanks, your my hero :)