Name: “Playing scripts”
The playing scripts package contains 3 simple scripts to play and stop sounds, effects and animations. It is useful for many simple actions, such as playing an alarm when you’re in a trigger, playing an effect every time you interact with something, or for an opening and closing door.
It contains 3 scripts, a “playAnimationScript”, “playSoundScript” and “playEffectScript”.
The “playAnimationScript” takes 2 animation strings (you can find these on a mesh that has animations by hovering over the button in the property window called “Copy Animation Names”). It has functions to play the first or second animation, or to toggle between the two.
The “playSoundScript” and “playEffectScript” essentially function in the same way. You provide a sound or effect asset for it to play, and it has functions to play, stop, or toggle the sound or effect. You can also tick “oneAllowed” which means it’ll only ever create one. This should be ticked for looping sounds or effects, where you don’t want “Play” to end up creating more sounds or effects while the first is still active.
The package also contains 3 templates, which show how each of the scripts can be used. These are “Animating Door”, “Sound Machine” and “Effect Campfire”, and are all set up to use the “onInteract” event in the property window to trigger their functions.
You can see each of these demonstrated in the packages workshop stream here - https://www.youtube.com/watch?v=85_IIDuYjHY