private static void RenderSceneObjectField <T>(ref ComponentRef <T> componentRef, ref bool dataChanged) where T : class { //If current component is valid if (componentRef.IsValid()) { //Check its scene is loaded Scene scene = componentRef.GetGameObjectRef().GetSceneRef().GetScene(); if (scene.isLoaded) { //Then render component field if (RenderObjectField(ref componentRef)) { dataChanged = true; } } //If the scene is not loaded show warning and allow clearing of the component else if (GameObjectRefEditor.RenderSceneNotLoadedField(componentRef.GetGameObjectRef())) { componentRef = new ComponentRef <T>(GameObjectRef.eSourceType.Scene); dataChanged = true; } } //Else don't have a valid component set, renderer object field else if (RenderObjectField(ref componentRef)) { dataChanged = true; } }
private static void RenderLoadedObjectField <T>(ref ComponentRef <T> componentRef, ref bool dataChanged) where T : class { //If the component is valid if (componentRef.IsValid()) { //Check its scene is loaded Scene scene = componentRef.GetGameObjectRef().GetSceneRef().GetScene(); if (scene.isLoaded) { //If loaded and not tried finding editor loader, find it now GameObjectLoader gameObjectLoader = componentRef.GetGameObjectRef().GetEditorGameObjectLoader(scene); //If have a valid loader... if (gameObjectLoader != null) { //Check its loaded if (gameObjectLoader.IsLoaded()) { //Then render component field if (RenderObjectField(ref componentRef)) { dataChanged = true; } } //If the loader is not loaded show warning and allow clearing of the component else if (GameObjectRefEditor.RenderLoadedNotLoadedField(gameObjectLoader)) { componentRef = new ComponentRef <T>(GameObjectRef.eSourceType.Loaded); dataChanged = true; } } } //If the scene is not loaded show warning and allow clearing of the component else if (GameObjectRefEditor.RenderSceneNotLoadedField(componentRef.GetGameObjectRef())) { componentRef = new ComponentRef <T>(GameObjectRef.eSourceType.Loaded); dataChanged = true; } } //Else don't have a component set, render component field else if (RenderObjectField(ref componentRef)) { dataChanged = true; } }