Audio not working


#1

Hi there,

I’m looking to trigger a sound when a plane is pressed down.
There doesn’t seem to be any step-by-steps on this so i’m missing something crucial…

I have a 1 second audio clip, tried both wav and ogg.

The clips aren’t playing sound when the play icon is pressed in the properties menu.
Nor does any sound happen when you create a timeline.

My presseddown script looks like this:

const lilypad_png1 = parent;

  • What do will I need to write in the myaudio.start();

Thank you for your help!


#2

You may need to put in the entire path to play it. It might be because the audio object has not been added to the scene after you generate it.

I’m not really sure since I have always added clips as nodes in the project editor and referenced them directly.
I find this to be easier, unless something needs created at runtime.
This also prevents generating a new audio object every time you press the plane.