Hi guys,
Im adapting the beginner’s roll a ball game that is used as a tutorial for Unity,
I currently have a ball rolling around picking up cubes. Ive added two extra cubes that alter the balls speed and physics upon collision.
I only want these effects to last for 5 seconds after colliding with the cube, then to go back to normal.
I’ve tried countless things but nothing seems to work.
Here is my collision code
I’ve tried using Time.deltaTime but this won’t work.
void OnTriggerEnter(Collider other)
{
if (other.gameObject.CompareTag ("Pick Up"))
{
other.gameObject.SetActive (false);
count = count + 1;//causes the count to increase by one upon collision
setCountText ();
}
if (other.gameObject.CompareTag ("Special Pick Up")) {
other.gameObject.SetActive (false);
speed = speed * 3;
}
if (other.gameObject.CompareTag ("Special Pick Up 2")) {
other.gameObject.SetActive (false);
changeDirection = true;
speed = 5;
}
}
if anyone can help ill love you forever! thanks!!