Skip to main content

AmbienceAudio

A class in Root.Township, the global namespace.

A sound source for ambience that applies its own volume through the AmbienceManager volume RTPC and can be muted. Client side; a component on ambience objects.

Constructors​

MemberWhat it is
AmbienceAudio()Unity makes components itself; use AddComponent or spawn a prefab instead of new.

Fields​

3 private and internal fields
MemberWhat it is
private bool isMutedBacking field for IsMuted.
private float volumeBacking field for Volume.
private RTPCValue volumeValueThe prepared volume RTPC value attached to the playing sound. Null until first played.

Properties​

MemberWhat it is
bool IsMuted { get; set; }Mutes or unmutes the ambience by setting the RTPC to 0 or back to Volume.
float Volume { get; set; }Ambience volume. Setting it updates the RTPC right away unless muted.

Methods​

3 private and internal methods
MemberWhat it is
private void AssignVolumeProperty()Runs on play: creates the volume RTPC value from AmbienceManager if needed and adds it to the sound's properties.
private void Awake()Hooks AssignVolumeProperty to the play event.
private void OnDestroy()Unhooks the play event and stops the sound.

Used in​

Members of other types that take, return or hold a AmbienceAudio: