- Home /
Question by
MobinYaqoob · Mar 09, 2015 at 11:40 AM ·
unity 2dunity 4.6
UIText Color Alpha not working
I want to make instantiate and fade out a UIText in unity but its not working
GameObject score=Instantiate(Score,posScore,Quaternion.identity) as GameObject;
StartCoroutine(FadeOut(score));
IEnumerator FadeOut(GameObject score)
{
Color alpha = score.GetComponent<Text>().color;
while (alpha.a > 0)
{
alpha.a = 0;
alpha.a -= Time.deltaTime / time;
yield return null;
}
}
I instantiate a Score object which is a Text Prefeb and then try to disapear slowly but my code is not working.
Comment
Are you adding the score object as a child to a canvas in the scene? After instantiation, what does the Hierarchy look like?
ScoreCanvas->ScorePanel->Score this is the hirarchy .
Your answer
Follow this Question
Related Questions
ITween IsLocal not works properly 0 Answers
Can Unity 4.6 UI System be used for physics based gameplay? 1 Answer
Unity3d : Moving a sprite body causes jitter 1 Answer
Button not working Unity New UI 0 Answers
Animation through Animator in unity 1 Answer