AudioMixerGroup.audioMixer
Declaration
public Audio.AudioMixer audioMixer;Описание
Получить доступ к AudioMixer, к которому принадлежит этот AudioMixerGroup (только для чтения).
Это свойство полезно, если вы хотите получить доступ к AudioMixer и изменить его свойства или свойства его групп динамически.
using UnityEngine; using UnityEngine.Audio;
public class ExampleAudioMixer : MonoBehaviour { public AudioMixerGroup audioMixerGroup;
void Start() { // Output the name of the AudioMixer that this AudioMixerGroup belongs to AudioMixer parentMixer = audioMixerGroup.audioMixer; Debug.Log("AudioMixer Name: " + parentMixer.name);
// Use the exposed parameters of different AudioMixerGroups to change the volume of those groups. // Make sure to expose the parameters you want to change in your groups and rename them to something memorable. // "TestVolume" and "MainVolume" are the exposed and renamed volume parameters of 2 different AudioMixerGroups. parentMixer.SetFloat("TestVolume", -80f); parentMixer.SetFloat("MainVolume", 5.0f); } }