Version: 2022.1
言語: 日本語

Mobile

class in UnityEngine

マニュアルに切り替える

説明

This class encapsulates properties and methods to handle audio output thread on iOS/Android.

You may be able to reduce the power consumption of your app or game by using this class. In general, for apps with simple looped music and short sound effects, you should set AudioSettings.Mobile.stopAudioOutputOnMute to true, and also call AudioSettings.Mobile.StopAudioOutput if the user of your app sets music/sound volume to 0 in game settings. This helps to reduce power consumption on most mobile devices. Also you can check AudioSettings.Mobile.muteState property and listen to AudioSettings.Mobile.OnMuteStateChanged event to stop/start audio output thread when required.

However, if your game or app has more complex sound or music logic, doing this could cause synchronization issues. In particular, any sounds playing when output is stopped are resumed from the same position when output is restarted, and so may be out of sync with any gameplay code that continued to run during that time. Therefore this setting may not be suitable if you are relying on gameplay elements that should be synchronized with parts of audio that may be continuing to play during output being switched off or on.

Static 変数

audioOutputStartedReturns true if audio output thread is working.
muteStateReturns true if current device media volume is 0.
stopAudioOutputOnMuteSet this property to true to make audio output thread automatically stop when device media volume is set to 0 and to start it again when volume is not 0.

Static 関数

StartAudioOutputStarts audio output thread on Android/iOS.
StopAudioOutputStops audio thread on Android/iOS.

Events

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