pyunity.audio module¶
Classes to manage the playback of audio.
It uses the pygame.mixer library, and if
it cannot be initialized, then dummy
classes are made to prevent stop of program.
A variable in the config module called
audio will be set to False if this
happens.
-
class
pyunity.audio.AudioClip(file)[source]¶ Bases:
objectClass to store information about an audio file.
-
file¶ Name of the file
Type: str
-
sound¶ Sound file that can be played with a
pygame.mixer.Channel. Only set when the AudioClip is in anAudioSourcen a running scene.Type: pygame.mixer.Sound
-
-
class
pyunity.audio.AudioSource[source]¶ Bases:
pyunity.core.ComponentManages playback on an AudioSource.
-
PlayOnStart¶ Whether it plays on start or not.
Type: bool
-
Loop¶ Whether it loops or not. This is not fully supported.
Type: bool
-
AddComponent(component)¶ Calls AddComponent on the component’s GameObject.
Parameters: component (Component) – Component to add. Must inherit from Component
-
GetComponent(component)¶ Calls GetComponent on the component’s GameObject.
Parameters: componentClass (Component) – Component to get. Must inherit from Component
-