Skip to content

Commit

Permalink
Merge pull request #1 from kameffee/develop
Browse files Browse the repository at this point in the history
Bugfix
  • Loading branch information
kameffee authored Jan 9, 2022
2 parents 82f354d + 127748a commit 8f0ba8f
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 8 deletions.
8 changes: 7 additions & 1 deletion Packages/AudioPlayer/Runtime/AudioPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -83,4 +89,4 @@ public void InitializeSe()
_seManager.Initialize();
}
}
}
}
5 changes: 3 additions & 2 deletions Packages/AudioPlayer/Runtime/BgmManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ public class BgmManager : MonoBehaviour
public static BgmManager Create()
{
var bgm = new GameObject(ManagerName);
DontDestroyOnLoad(bgm);
return bgm.AddComponent<BgmManager>();
}

Expand Down Expand Up @@ -169,7 +170,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)
Expand All @@ -183,4 +184,4 @@ public void SetVolume(float volume)
}
}
}
}
}
5 changes: 3 additions & 2 deletions Packages/AudioPlayer/Runtime/SeManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public class SeManager : MonoBehaviour
public static SeManager Create()
{
var se = new GameObject(SeManagerName);
DontDestroyOnLoad(se);
return se.AddComponent<SeManager>();
}

Expand Down Expand Up @@ -85,7 +86,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)
Expand All @@ -99,4 +100,4 @@ public void SetVolume(float volume)
}
}
}
}
}
4 changes: 2 additions & 2 deletions Packages/AudioPlayer/Runtime/SeSlider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

namespace Kameffee.AudioPlayer
{
[AddComponentMenu("UI/Audio/BgmSlider")]
[AddComponentMenu("UI/Audio/SeSlider")]
public class SeSlider : MonoBehaviour
{
[SerializeField]
Expand All @@ -25,4 +25,4 @@ private void SetVolume(float volume)
AudioPlayer.Instance.Se.SetVolume(volume);
}
}
}
}
2 changes: 1 addition & 1 deletion Packages/AudioPlayer/package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down

0 comments on commit 8f0ba8f

Please sign in to comment.