public static void StartMusic() { MusicManager managerInstance = ResourcesExtensions.InstantiateFromResources <MusicManager>(prefabPath, null); instance = managerInstance; DontDestroyOnLoad(managerInstance); }
public static UIBlocker Create(Transform requester) { // Make sure the requester is not null if (!requester) { throw new System.ArgumentNullException(nameof(requester)); } Canvas canvas = requester.GetComponentInParent <Canvas>(); // If there is no canvas in the parent then throw exception if (!canvas) { throw new System.ArgumentException( $"Cannot request a UIBlocker for object {requester} " + $"because it is not a canvas or a child of a canvas!"); } // Make sure we have the root canvas canvas = canvas.rootCanvas; // Create a UI blocker from resources UIBlocker instance = ResourcesExtensions.InstantiateFromResources <UIBlocker>(nameof(UIBlocker), canvas.transform); instance.transform.SetAsLastSibling(); return(instance); }
public static TutorialUI InstantiateFromResources(Transform parent, string resourcePath = null) { if (string.IsNullOrWhiteSpace(resourcePath)) { resourcePath = defaultResourcePath; } return(ResourcesExtensions.InstantiateFromResources <TutorialUI>(resourcePath, parent)); }
public static GenericYesNoWindow InstantiateFromResource(Transform parent, string prefabPath = null) { if (string.IsNullOrWhiteSpace(prefabPath)) { prefabPath = defaultPrefabPath; } return(ResourcesExtensions.InstantiateFromResources <GenericYesNoWindow>(prefabPath, parent)); }
public static UnlockUI InstantiateFromResources(Transform parent, string prefabPath = null) { if (string.IsNullOrWhiteSpace(prefabPath)) { prefabPath = defaultResourcePath; } return(ResourcesExtensions.InstantiateFromResources <UnlockUI>(prefabPath, parent)); }
public static void Initialize() { // Instantiate the effects manager from the resources and make it not destroy on load instance = ResourcesExtensions.InstantiateFromResources <OutlineManager>(nameof(OutlineManager), null); DontDestroyOnLoad(instance); // Re-initialize the pools on scene loaded SceneManager.sceneLoaded += instance.OnSceneLoaded; }
public static void CreateDebuggingUI() { if (!instance) { instance = ResourcesExtensions.InstantiateFromResources <DebuggingUI>(prefabPath, null); DontDestroyOnLoad(instance.gameObject); // Update the ui each time that a new scene is loaded SceneManager.sceneLoaded += instance.UpdateUI; } }
public static void CreateInstance() { if (!instance) { // Try to instantiate the component from the resources folder string typename = typeof(BehaviourType).Name; instance = ResourcesExtensions.InstantiateFromResources <BehaviourType>(typename, null); // Make the instance not destroyed on load DontDestroyOnLoad(instance); } }
public static void Initialize() { instance = ResourcesExtensions.InstantiateFromResources <AudioPanel>(nameof(AudioPanel), null); DontDestroyOnLoad(instance); }