当前位置:网站首页>[unity development tips] unity mixer mixer controls global volume
[unity development tips] unity mixer mixer controls global volume
2022-07-19 02:37:00 【Fantasy world】
Catalog
1. establish MasterMixer,MusicMixer,soundEffectMixer
2. Set parent-child relationship
5、 ... and :Slider Slider settings
One : Preface
I haven't used this mixer tool for many years , After all, many functions are controlled by writing their own code as much as possible , In this way, it will be easy to maintain and modify later , Recently, some students are consulting the sound management system , Especially how to use this mixer . I took advantage of this opportunity to get to know and learn , Record here . Here we only record the unified control properties of the mixer , Other audio resource management modules are not involved here , There will be time to record separately .
Two : Control logic
Our commonly used game audio types are mainly divided into three categories :1.Music The background music ( There has always been )2. Instantaneous sound effect ( Instant generation )3. Plot dubbing ( It can also be classified as sound effect ). When using code management to control these sound effects , Especially the management setting of sound volume , All of them are classified management first, then all of them are traversed, and then the volume is set , Although it is troublesome, its advantage is that it is convenient for us to maintain and modify , The other is to separate the volume control logic or other attribute control and give it to the mixer for processing. In fact, it is also very convenient . My idea here is to create three mixers, one overall Mixer, One MusicMixer And a SoundEffectMixer, Among them, the overall situation is only right MusicMixer and SoundEffectMixer Conduct management , Then the specific sounds are attributed to SoundEffectMixer and MusicMixer management . In simple words, you can also make one directly Mixer Manage music directly 

3、 ... and : Make mixer Mixer
1. establish MasterMixer,MusicMixer,soundEffectMixer
Right click to create mixer , Change the name to MasterMixer.., The other two can be clicked Mixers The following plus sign can also be created by right clicking on the outside .


2. Set parent-child relationship
1.. Click the plus sign to create music and sound

2. hold music and sound Drag onto master Under the child nodes of . And associate the corresponding Group The nodes below

3. Set the corresponding AudioSource
Select the music in the scene respectively , And then put the right MasterMixer Drag the corresponding type into the music Output In the trough


4. Burst attribute
1. Choose Mastermixer,2. Then select the target Mixer 3. Find the right Volume attribute 4. stay Volume Right click on the top to reveal the attribute 5. Modify the attribute name f2

Three Mixer It will leak out

Four : Edit code control
public class Test : MonoBehaviour
{
public AudioMixer audioMixer;//MasterMixer
public AudioSource soundClick;//sound
public void SetAllVolume(Slider s)
{
audioMixer.SetFloat("MasterVolume", s.value);
}
public void SetMusicVolume(Slider s)
{
audioMixer.SetFloat("MusicVolume", s.value);
}
public void SetEffectVolume(Slider s)
{
audioMixer.SetFloat("EffectVolume", s.value);
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.P))
{
soundClick.Play();
}
}
}5、 ... and :Slider Slider settings
1. Set according to the maximum and minimum volume in the mixer slider The maximum and minimum value of [-40,0]
2. Add event

End of the flower
边栏推荐
- 网络层协议和IP数据包的格式(详解)
- GoReplay
- STL -- stack container
- Use JMeter to test services based on websocket protocol
- Logical vulnerability - authentication vulnerability
- Network layer protocol and IP packet format (detailed)
- 并发虚拟用户、RPS、TPS的解读
- Getting to know Alibaba cloud environment construction for the first time: unable to connect remotely, and having been in the pit: the server Ping fails, FTP is built, the server builds the database,
- 安装软件提示无法定位程序输入点AddDllDirectory于动态链接库Kernel32.dll上(文末有下载地址)
- Jmeter接口测试之响应断言
猜你喜欢

静态路由(详)

STL -- stack container

Network layer transmission protocol (detailed)
![[Ruiji takeout ⑩] rough learning of Linux & rough learning of redis](/img/2f/9788ddea24f090d872ccdf82ccd8d8.png)
[Ruiji takeout ⑩] rough learning of Linux & rough learning of redis

Full link voltage measurement

Interpretation of concurrent virtual users, RPS and TPS

Attack and defense the world ---- shrink

Signal and system experiment

剑指 Offer 53 - I. 在排序数组中查找数字 I

Server knowledge (details)
随机推荐
网络层协议和IP数据包的格式(详解)
接口(Collection/Map)- 各接口的实现与对比
Attack and defense the world ---- shrink
Attack and defense world - easytornado notes
ctfhub--ssrf
逻辑漏洞---登录验证码安全
性能之流量回放
性能瓶颈定位XMind
CTFHub----RCE
postman的json脚本转jmeter的jmx脚本
理解:什么是接口,接口的概念
If a hunter shoots a rabbit with a gun
2022.6.28-database-1 Isolation level of database
Network layer transmission protocol (detailed)
Visual studio 2019-qt debugging
并发虚拟用户、RPS、TPS的解读
服务器知识(详情)
The solution to the bounce and offset of unity3d game characters when jumping to the ground
Analysis of the paradise of metauniverse developers the ecological value of the metauniverse protocol caduceus
bugku---game1
