I have cubes that are instantiated multiple times (at random amounts) each with an attached script that will change the renderer color and play a sound via OnMouseOver . I have another object that will set the timescale to 0 when the escape button is pressed to “pause” the game. However, the cubes will still change color and play a sound when the mouse is over them. How would I get these cube objects to stop playing a sound and changing renderer color when I have the game “paused?”
I would add in a condition for the events following mouseover
if(Time.timeScale != 0)
{
//Change color and play sound
}
else
{
//Pause or Stop the music
}
1 Like
It worked great, thanks!
Absolutely no problem. I am glad I could help.
Thanks for that, ur reply is still working in 2022