Hi,
I’ve created different projects with Unity, and now am working on a simple project in Unity3.
This thing has got me going for some time now and can’t wrap my head around it.
I’m trying the simplest thing: play a sound at the right moment.
I’m checking some stuff in a OnTriggerStay event, and when the time is right i fire a function which does some stuff. The function is called at the right time, when i print something to the console this is printed at the right time.
BUT when i play a sound (from a preloaded gameobject with audiosource), my sound is played after a small delay, which is not what i want.
The called function looks like this:
void my_function() {
print("log test"); // called @ right moment
GameObject.Find("ObjectWithAudioSource").audio.Play(); //played after delay
}
My sound doesn’t have any silence at start, it immediately gives sound. I tried a compressed mp3 and wav version of the sound. I don’t understand what is going wrong here, must be something simple…
Any help is very much appreciated.