Program/Unity 2024. 1. 23. 18:15

코루틴 사용 기본 초기화

 

public void Start()
{
    StartCoroutine(CoroutineInit());
}

 

public IEnumerator CoroutineInit()
{

        //Firebase 기본.

        var task = FirebaseApp.CheckAndFixDependenciesAsync();

        yield return new WaitUntil(() => task.IsCompleted);

        if (task.IsFaulted || task.IsCanceled)
        {
            Debug.LogError("Error: " + task.Exception);
        }
        else
        {
            var app = FirebaseApp.DefaultInstance;

 

            if (app != null)
            {

                  //FireStore Database
                 dbRefFbStore = FirebaseFirestore.DefaultInstance;


                 //RealTime Database
                 //dbRefRealTime = FirebaseDatabase.GetInstance(url).RootReference;

                 //FireBase Auth
                 authFb = FirebaseAuth.DefaultInstance;

            }
            else
            {
                Debug.LogError("Firebase Init Fail");
            }
        }

}

posted by 헛소리
: