the respawn timer need to wait 2 seconds while it disappears, For some reason in the inspector when i do whats necessary in game for this function to get called the renderer doesn’t get unchecked. So i guess its either placement in the Update method or something i did here even though i don’t get any error.
void Update()
{
if (numberOfClicks <= 0)
{ Vector3 position = new Vector3(Random.Range(-6, 6), Random.Range(-4, 4), 15);
//Use the properties of hit to get the transform of what ever got hit to changes it position
WaitUntilRespawn();
transform.position = position;
numberOfClicks = 2;
}
}
IEnumerator WaitUntilRespawn()
{
renderer.enabled = false;
yield return new WaitForSeconds(respawnWaitTime);
renderer.enabled = true;
}