当我注视一个物体时,我有这个命中信息。该物体在凝视时出现,但在视线移开时消失。我希望对象在观看后显示 10 秒。我在正确的道路上吗?
float timeLeft = 10.0f;
timeLeft -= Time.deltaTime;
if (Hit == InfoCube)
{
GameObject.Find("GUIv2").transform.localScale = new Vector3(0.02f, 0.2f, 0.8f) // Shows object
}
else if (timeLeft < 0)
{
GameObject.Find("GUIv2").transform.localScale = new Vector3(0, 0, 0);
GameObject.Find("GUIv2").SetActive(false);
}