函数:go//游戏对象,time//消失时间
protected void FadeAway(GameObject go, float time)
{
Transform[] transforms = go.GetComponentsInChildren<Transform>();
foreach (var transformChild in transforms)
{
Image image = transformChild.gameObject.GetComponent<Image>();
if (image)
{
image.color = new Color(255, 255, 255, 3f);
image.DOFade(0, time);
}
Text text = transformChild.gameObject.GetComponent<Text>();
if (text)
{
text.color = new Color(text.color.r, text.color.g, text.color.b, 3f);
text.DOFade(0, time);
}
}
}
调用:
FadeAway(AnswerTruePanel, 2f);
最后
以上就是含糊心锁最近收集整理的关于Unity3D面板显示几秒后消失的全部内容,更多相关Unity3D面板显示几秒后消失内容请搜索靠谱客的其他文章。
发表评论 取消回复