Hey everyone, I was just wondering - I have a animation clip set up on a mesh that makes it disappear and reappear every 10 seconds, how could I make it so that a sound plays every time it appears? Image of what I have done below. Where I got to now, it plays all my sounds once at the same time and doesn’t continue and just ends. They are clearly connected, if they weren’t then “Play On Awake” wouldn’t make it all play once at the exact same time, so I have to figure out how to make it continue playing whenever the meshes hide and unhide. Thanks.
some ideas:
- animation events to call method for playing audio Unity - Manual: Use Animation Events
- if gameobject gets fully disabled then enabled, script with OnEnable would catch that Unity - Scripting API: MonoBehaviour.OnEnable()
- if its fixed 10s time, could try matching coroutine loop to play sounds Unity - Scripting API: Coroutine
- probably timeline could be used also About Timeline | Timeline | 1.7.6
This is what I have right now if it helps. Also, I’ve been using Unity for the past 5 months but I’m still learning. I was trying to use the timeline, so if you have any actual ideas with an explanation that would be nice haha. Where I got to now, it plays all my sounds once at the same time and doesn’t continue and just ends. The sounds don’t continue afterwards. They are clearly connected, if they weren’t then “Play On Awake” wouldn’t make it all play once at the exact same time, so I have to figure out how to make it continue playing whenever the meshes hide and unhide instead of instantly ending.