I have an object that plays a sound when it is collided with.
How do i get that object to not play that sound when the scene loads, and it settles into position.
function OnCollisionEnter (collision : Collision) {
audio.clip = BarrelSound;
audio.Play();
}
You could put a 5 second timer in that stops the audio from playing until the time is reached. Psuedo:
var timer : float = 0;
Update()
{
timer += 1*Time.deltaTime;
}
OnCollisionEnter (collision : Collision) {
if(timer >= insert max time here)
{
//collision stuff
}
}
might work. ill try that.
or just use timeSinceLevelLoad instead of timer variable
I never knew about that… cool.