Androidアプリで音楽を流したいのですが
スクリーンロックがかかると鳴らなくなってしまいます。
スクリーンロックがかかっても流れるようにするには
OnApplicationPauseで行けるような気がしていたのですが
実際に設定してみても音声が流れません。
どうすればスクリーンロックになっても流れるようになるでしょうか?
環境)
PC: mac
Unity2018.3.0f2
言語:C#
using System.Collections; using System.Collections.Generic; using UnityEngine; public class SoundScript : MonoBehaviour { #pragma warning disable 649 [SerializeField]AudioClip audioClip; AudioSource seSource; // Start is called before the first frame update void Start() { seSource = gameObject.GetComponent<AudioSource>(); seSource.clip = audioClip; seSource.Play(); } // Update is called once per frame void Update() { } void OnApplicationPause(bool pauseStatus){ if(pauseStatus){ seSource.Play(); } } }

回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。