I want to make an object appear on collision, wait for a couple of seconds and make it disappear again.
public class TriggerObject : MonoBehaviour {
public GameObject object;
void OnTriggerEnter(Collider other)
{
object.SetActive(true);
// Wait for a second
object.SetActive(false);
}
}
I have no idea how to make this to wait for a second…
I didn’t figure out how to build in “yield WaitForSeconds(1);”.
Is there any function which can solve my problem or is there any other way to solve this?