Unity3D: is it possible to check the volume of both Android and iPhone devices?

前端 未结 1 1334
天命终不由人
天命终不由人 2021-01-06 21:22

I have the following code:

void Update(){
    GetComponent ().text = AudioListener.volume.ToString();
}

After pu

1条回答
  •  悲&欢浪女
    2021-01-06 21:35

    Just for the record,

    It's a great question, can you get the phone volume setting, from Unity?

    Firstly: do note that AudioListener.volume is totally unrelated. That is simply the volume as Unity thinks of it for your playing music or sound effects.

    Secondly: I'm afraid to say, I'm fairly sure there is no way to get the phone volume setting, from Unity, as of 2016.

    If someone knows better - answer!

    Nice question.


    UPDATE (from comments)

    Note. It is possibly possible to control system volume. But OP would have to write native plugins for that.

    Consider these QA:

    • For Android: How do you get/set media volume (not ringtone volume) in Android?
    • For iOS: iOS 9: How to change volume programmatically without showing system sound bar popup?

    Note however that changing the volume in iOS (nothing to do with Unity) is a tricky issue regarding whether Apple approve it on the app store. Same for Android. These issues are unrelated to Unity and require knowledge about the app store, Samsung hardware, etc, in whatever year you are reading this. AND note that in many QA about "changing volume" on phones, there is again simply confusion about changing the volume of something in an app versus "the actual phone volume control".

    0 讨论(0)
提交回复
热议问题