2 c# unity-game-engine ngui unityscript
如何使用SetActiveRecursively(Moment = 1秒)在Unity中创建闪烁对象.
我的例子(改变):
public GameObject flashing_Label;
private float timer;
void Update() {
while(true)
{
flashing_Label.SetActiveRecursively(true);
timer = Time.deltaTime;
if(timer > 1)
{
flashing_Label.SetActiveRecursively(false);
timer = 0;
}
}
}
Run Code Online (Sandbox Code Playgroud)
public GameObject flashing_Label;
public float interval;
void Start()
{
InvokeRepeating("FlashLabel", 0, interval);
}
void FlashLabel()
{
if(flashing_Label.activeSelf)
flashing_Label.SetActive(false);
else
flashing_Label.SetActive(true);
}
Run Code Online (Sandbox Code Playgroud)