Created
September 3, 2019 21:48
-
-
Save eduardonunesp/4173856b3a2d16a8426df3fed3929955 to your computer and use it in GitHub Desktop.
Loader
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class Loader : MonoBehaviour | |
{ | |
void Awake() | |
{ | |
GameObject gameManager = GameObject.Find("GameManager"); | |
if (!gameManager) | |
{ | |
Debug.LogWarning("You need to add Prefab GameManager"); | |
return; | |
} | |
//Check if a GameManager has already been assigned to static variable GameManager.instance or if it's still null | |
if (GameManager.instance == null) | |
{ | |
//Instantiate gameManager prefab | |
Instantiate(gameManager); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment