Advertisement
jefflynch

Untitled

Apr 20th, 2023
20
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1.  
  2. [SerializeField] EventReference m_BackgroundMusic;
  3. private EventInstance _backgroundMusicEventInstance;
  4.  
  5. PLAYBACK_STATE _playbackState;
  6. private void Start()
  7. {
  8. _backgroundMusicEventInstance = RuntimeManager.CreateInstance(m_BackgroundMusic);
  9.  
  10. _backgroundMusicEventInstance.start();
  11.  
  12.  
  13.  
  14.  
  15. }
  16.  
  17. private void Update()
  18. {
  19. _backgroundMusicEventInstance.getPlaybackState(out _playbackState);
  20.  
  21. if (_playbackState == PLAYBACK_STATE.STOPPED)
  22. {
  23. _backgroundMusicEventInstance.start();
  24. Debug.Log($"Restarting music");
  25. Debug.Log($"Playback state: {_playbackState}");
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement