Delayed music start
This commit is contained in:
		
							parent
							
								
									2de586fd42
								
							
						
					
					
						commit
						7ab99b81ff
					
				
					 1 changed files with 7 additions and 0 deletions
				
			
		| 
						 | 
					@ -1,5 +1,6 @@
 | 
				
			||||||
using System.Collections;
 | 
					using System.Collections;
 | 
				
			||||||
using System.Collections.Generic;
 | 
					using System.Collections.Generic;
 | 
				
			||||||
 | 
					using System.Threading.Tasks;
 | 
				
			||||||
using UnityEngine;
 | 
					using UnityEngine;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public class MusicStarter : MonoBehaviour
 | 
					public class MusicStarter : MonoBehaviour
 | 
				
			||||||
| 
						 | 
					@ -8,6 +9,12 @@ public class MusicStarter : MonoBehaviour
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    void Start()
 | 
					    void Start()
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
					        DelayedSongRequest();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    async void DelayedSongRequest()
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        await Task.Delay(250);
 | 
				
			||||||
        GameObject.FindWithTag("MusicManager")
 | 
					        GameObject.FindWithTag("MusicManager")
 | 
				
			||||||
            .GetComponent<MusicManager>()
 | 
					            .GetComponent<MusicManager>()
 | 
				
			||||||
            .PlaySong(songName);
 | 
					            .PlaySong(songName);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue