Files

20 lines
1.0 KiB
Plaintext

URL: https://wiki.studiominus.nl/internalReference/RandomSoundBehaviour.html
Title: People Playground Modding - RandomSoundBehaviour
==================================================
public class RandomSoundBehaviour
Inherits MonoBehaviour
Can play sounds picked randomly from the Clips array.NOTE: Just use the PlayRandomClipBehaviour instead. This class is redundant (but still functional)
Fields
public AudioClip[] Clips
Clips to pick from
public AudioSource AudioSource
Optional audio source. If this is null, the sound will be played using PhysicalBehaviour.PlayClipOnce(AudioClip) if available. Otherwise, no sound is played.
public bool PlayOnStart
A random sound will be played on start if this is set to true
Methods
public void PlayClip()
Play a random clip from Clips. If Clips is null or empty, no sound will be played. If AudioSource is null, this will fall back to the PhysicalBehaviour if available. If none of those are available, no sound is played.Also won't do anything if the component is not enabled