I’m trying to have a sound delay based on the the user’s input on minimum and maximum
Example Min = .4 and maximum = 3, I want to delay the sound in seconds using:
var soundDelayMin = .0f;
var soundDelayMax = .0f;
WaitForSeconds.Random.Range(soundDelayMin, soundDelayMax);
audio.PlayOneShot(sound);
but it isn’t working correctly I think I need another way of calculating the time for the floats. It has to be random between the two float numbers though.
Any ideas? I’ve been at this all day and have looked through every piece of documentation and still nothing…
I keep getting NullReferenceException: Object reference not set to an instance of an object
Thanks Eric for the quick response, but I’ve tried this and all I get is: Update() can not be a coroutine.
Is there something I have to set up in order to properly use a coroutine? My code is in the Update section so I need it to go there unless there’s another way.