File tree Expand file tree Collapse file tree
Samples~/Singleton/Runtime Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ using OpenMusicPlayer . Core ;
2+
3+ namespace OpenMusicPlayer . Samples . Singleton
4+ {
5+ public class MusicPlayerSingleton : MusicPlayerCore
6+ {
7+ public static MusicPlayerSingleton Instance { get ; private set ; }
8+
9+ protected override void Awake ( )
10+ {
11+ base . Awake ( ) ;
12+ // Make unique object (Singleton)
13+ if ( Instance != null && Instance != this )
14+ {
15+ // Destroy other
16+ Destroy ( gameObject ) ;
17+ }
18+ else
19+ {
20+ Instance = this ;
21+ // Add don't destroy on load.
22+ DontDestroyOnLoad ( this ) ;
23+ }
24+ }
25+ }
26+ }
Original file line number Diff line number Diff line change 77 "url" : " https://github.com/Aestial"
88 },
99 "license" : " MIT" ,
10- "version" : " 0.1.7 " ,
10+ "version" : " 0.1.8 " ,
1111 "unity" : " 2019.4" ,
1212 "description" : " Open and simple music playback system based on Events and ScriptableObjects playlists" ,
1313 "keywords" : [
4040 {
4141 "displayName" : " HUD Samples" ,
4242 "description" : " Multiple music player HUD views" ,
43- "path" : " Samples~/HUD"
43+ "path" : " Samples~/HUD"
44+ },
45+ {
46+ "displayName" : " Singleton Player" ,
47+ "description" : " Don't Destroy On Load singleton wrapper" ,
48+ "path" : " Samples~/Singleton"
4449 }
4550 ]
4651}
You can’t perform that action at this time.
0 commit comments