Managing multiple images fillamount by one function?
I want to fill the button that I clicked but when I click multiple buttons the button that I clicked before stops and the other button starts.
That's the script :
public function ActionTime (actionSeconds : float)
{
actionTime = actionSeconds;
actionTimeComplete = actionSeconds;
}
//COOLDOWN IMAGES
public function CooldownImage (imageForCooldown : Image)
{
imageCooldown = imageForCooldown;
CooldownFunction();
}
public function CooldownFunction ()
{
var actionTime = 0f;
imageCooldown.fillAmount=actionTime;
imageCooldown.GetComponent(Button).interactable = false;
while(actionTime < actionTimeComplete )
{
actionTime += Time.deltaTime;
imageCooldown.fillAmount=actionTime/actionTimeComplete;
yield;
}
moneyGlobal+=moneyToGive;
XPGlobal+=xpToGive;
imageCooldown.GetComponent(Button).interactable = true;
}
Everything works fine until I click another button. Basically that script can complete one image fillamount at once , how can I manage to complete multiple images without creating a bunch of functions?
Comment
Best Answer
Answer by ma22be61 · Jan 22, 2016 at 05:56 PM
Nevermind.
I got it. It was simpler than I tought.
Your answer
Follow this Question
Related Questions
Changing the image of a button with a script 1 Answer
How to make a UI mask for a button invisible? 0 Answers
Getting the position of a RectTransform 0 Answers
Problem with reticle and image 0 Answers