From 10a7fde662df3b1d534d4344ee91a861eb505e0d Mon Sep 17 00:00:00 2001 From: kameffee Date: Mon, 10 Jan 2022 04:40:48 +0900 Subject: [PATCH 1/5] Fix onChangeVolume --- Packages/AudioPlayer/Runtime/BgmManager.cs | 4 ++-- Packages/AudioPlayer/Runtime/SeManager.cs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Packages/AudioPlayer/Runtime/BgmManager.cs b/Packages/AudioPlayer/Runtime/BgmManager.cs index fc1292b..2c4efbb 100644 --- a/Packages/AudioPlayer/Runtime/BgmManager.cs +++ b/Packages/AudioPlayer/Runtime/BgmManager.cs @@ -169,7 +169,7 @@ public void UnPause() public void SetVolume(float volume) { var toVolume = Mathf.Clamp01(volume); - var isChange = volume != toVolume; + var isChange = _volume != toVolume; _volume = toVolume; foreach (var bgmPlayer in _bgmPlayers) @@ -183,4 +183,4 @@ public void SetVolume(float volume) } } } -} \ No newline at end of file +} diff --git a/Packages/AudioPlayer/Runtime/SeManager.cs b/Packages/AudioPlayer/Runtime/SeManager.cs index 75f89b4..3107136 100644 --- a/Packages/AudioPlayer/Runtime/SeManager.cs +++ b/Packages/AudioPlayer/Runtime/SeManager.cs @@ -85,7 +85,7 @@ public void Stop() public void SetVolume(float volume) { var toVolume = Mathf.Clamp01(volume); - var isChange = volume != toVolume; + var isChange = _volume != toVolume; _volume = toVolume; foreach (var sePlayer in _sePlayers) @@ -99,4 +99,4 @@ public void SetVolume(float volume) } } } -} \ No newline at end of file +} From 443b5a82eba857a7a6b2edeeab4c07bc4d90df99 Mon Sep 17 00:00:00 2001 From: kameffee Date: Mon, 10 Jan 2022 04:41:34 +0900 Subject: [PATCH 2/5] Add PreInitialize --- Packages/AudioPlayer/Runtime/AudioPlayer.cs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Packages/AudioPlayer/Runtime/AudioPlayer.cs b/Packages/AudioPlayer/Runtime/AudioPlayer.cs index 9bafbac..ce2ee03 100644 --- a/Packages/AudioPlayer/Runtime/AudioPlayer.cs +++ b/Packages/AudioPlayer/Runtime/AudioPlayer.cs @@ -50,6 +50,12 @@ public float MasterVolume public bool Initialized => _initialized; private bool _initialized; + [RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] + private static void PreInitialize() + { + _instance = null; + } + public void Initialize() { if (_initialized) @@ -83,4 +89,4 @@ public void InitializeSe() _seManager.Initialize(); } } -} \ No newline at end of file +} From e46d6229495a8f5b70747d5f03d65f27b29e6eeb Mon Sep 17 00:00:00 2001 From: kameffee Date: Mon, 10 Jan 2022 04:43:22 +0900 Subject: [PATCH 3/5] DontDestroy SeManager & BgmManager --- Packages/AudioPlayer/Runtime/BgmManager.cs | 1 + Packages/AudioPlayer/Runtime/SeManager.cs | 1 + 2 files changed, 2 insertions(+) diff --git a/Packages/AudioPlayer/Runtime/BgmManager.cs b/Packages/AudioPlayer/Runtime/BgmManager.cs index 2c4efbb..b667b62 100644 --- a/Packages/AudioPlayer/Runtime/BgmManager.cs +++ b/Packages/AudioPlayer/Runtime/BgmManager.cs @@ -27,6 +27,7 @@ public class BgmManager : MonoBehaviour public static BgmManager Create() { var bgm = new GameObject(ManagerName); + DontDestroyOnLoad(bgm); return bgm.AddComponent(); } diff --git a/Packages/AudioPlayer/Runtime/SeManager.cs b/Packages/AudioPlayer/Runtime/SeManager.cs index 3107136..df8fb84 100644 --- a/Packages/AudioPlayer/Runtime/SeManager.cs +++ b/Packages/AudioPlayer/Runtime/SeManager.cs @@ -21,6 +21,7 @@ public class SeManager : MonoBehaviour public static SeManager Create() { var se = new GameObject(SeManagerName); + DontDestroyOnLoad(se); return se.AddComponent(); } From 9da46313216121127a79d03636c6f88d134659d5 Mon Sep 17 00:00:00 2001 From: kameffee Date: Mon, 10 Jan 2022 04:46:16 +0900 Subject: [PATCH 4/5] Fix menu name --- Packages/AudioPlayer/Runtime/SeSlider.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Packages/AudioPlayer/Runtime/SeSlider.cs b/Packages/AudioPlayer/Runtime/SeSlider.cs index 97e6ce3..5460a41 100644 --- a/Packages/AudioPlayer/Runtime/SeSlider.cs +++ b/Packages/AudioPlayer/Runtime/SeSlider.cs @@ -3,7 +3,7 @@ namespace Kameffee.AudioPlayer { - [AddComponentMenu("UI/Audio/BgmSlider")] + [AddComponentMenu("UI/Audio/SeSlider")] public class SeSlider : MonoBehaviour { [SerializeField] @@ -25,4 +25,4 @@ private void SetVolume(float volume) AudioPlayer.Instance.Se.SetVolume(volume); } } -} \ No newline at end of file +} From 127748a55ce2f087f796767e734d24d82c2f7ec8 Mon Sep 17 00:00:00 2001 From: kameffee Date: Mon, 10 Jan 2022 05:49:11 +0900 Subject: [PATCH 5/5] version up --- Packages/AudioPlayer/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Packages/AudioPlayer/package.json b/Packages/AudioPlayer/package.json index ceb12da..055fc22 100644 --- a/Packages/AudioPlayer/package.json +++ b/Packages/AudioPlayer/package.json @@ -1,7 +1,7 @@ { "name": "com.kameffee.audio-player", "displayName": "AudioPlayer", - "version": "0.0.1", + "version": "0.0.2", "unity": "2019.4", "description": "Simple Audio Player", "author": {