Version: 2023.2

PlayerSettings.muteOtherAudioSources

切换到手册
public static bool muteOtherAudioSources ;

描述

运行 Unity 应用程序时,停止或允许在后台播放来自其他应用程序的音频。

This setting is shared between iOS and Android platforms.

Set this to true and your Unity application stops audio from other applications in the background, set to false and audio from background applications continues to play alongside your Unity application.

Unity ignores PlayerSettings.muteOtherAudioSources if at least one of the following is true: Unity Audio is disabled. (menu: Edit > Project Settings > Audio > Disable Unity Audio) Unity has stripped the AudioManager from the project at build time. AudioManager is stripped from the project if all of the following are true: There is no audio content in the project. The project uses IL2CPP. Strip Engine Code is enabled. Note: Starting with Android Marshmallow (6.0), setting this to false mutes the sound of your Unity application during an incoming phone call (while the phone is ringing). If you want to have this behavior on older Android versions, you have to add the READ_PHONE_STATE permission to the manifest. See the Android documentation for more information on build manifests.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961