I am having an issue with the user not staying logged in once they click the login button and the scene changes. I have a UserAccountManager.cs script that handles Awake() but I get an error in Unity that says DontDestroyOnLoad only works for rooot GameObjects or components on root GameObjects. I have the UserAccountManger script set inside my Account game object that handles the login/register panel. Here is my script:
using System.Collections; using System.Collections.Generic; using UnityEngine; using PlayFab; using PlayFab.ClientModels; using UnityEngine.Events; public class UserAccountManager : MonoBehaviour { public static UserAccountManager Instance; public static UnityEvent OnSignInSuccess = new UnityEvent(); public static UnityEvent<string> OnSignInFailed = new UnityEvent<string>(); public static UnityEvent<string> OnCreateAccountFailed = new UnityEvent<string>(); public static UnityEvent<string, string> OnUserDataRetrieved = new UnityEvent<string, string>(); string playFabID; void Awake() { if (Instance != null) { Destroy(gameObject); return; }else { Instance = this; DontDestroyOnLoad(this.gameObject); } } .... and so on