void Update() { try { if (Application.isPlaying && IsConstellationSelected()) { if (NodeWindow != null && previousSelectedGameObject != null && ScriptDataService.GetCurrentScript().IsInstance) { NodeWindow.Update(currentEditableConstellation.GetConstellation(), OnEditorEvent); } var selectedGameObjects = Selection.gameObjects; if (selectedGameObjects.Length == 0 || selectedGameObjects[0] == previousSelectedGameObject || selectedGameObjects[0].activeInHierarchy == false) { return; } else if (ScriptDataService.OpenedScripts.Count > 0) { ScriptDataService.CloseCurrentConstellationInstance(); Open(ScriptDataService.OpenedScripts.ToArray()[0]); previousSelectedGameObject = selectedGameObjects[0]; } else { ScriptDataService.Script = null; } var selectedConstellation = selectedGameObjects[0].GetComponent <ConstellationEditable>() as ConstellationEditable; if (selectedConstellation != null && selectedConstellation.ConstellationData != null) { currentEditableConstellation = selectedConstellation; previousSelectedGameObject = selectedGameObjects[0]; if (selectedConstellation.ConstellationData.GetType() == typeof(ConstellationTutorialScript)) { OpenConstellationInstance <ConstellationTutorialScript>(selectedConstellation.GetConstellation(), AssetDatabase.GetAssetPath(selectedConstellation.GetConstellationData())); } else { OpenConstellationInstance <ConstellationScript>(selectedConstellation.GetConstellation(), AssetDatabase.GetAssetPath(selectedConstellation.GetConstellationData())); } if (selectedConstellation.GetConstellation() == null) { return; } } } else { previousSelectedGameObject = null; } }catch (System.Exception exception) { UnexpectedError(exception.StackTrace); } }
void Update() { if (Application.isPlaying && IsConstellationSelected()) { if (NodeWindow != null && previousSelectedGameObject != null && ScriptDataService.GetCurrentScript().IsInstance) { NodeWindow.Update(currentEditableConstellation.GetConstellation(), OnEditorEvent); } var selectedGameObjects = Selection.gameObjects; if (selectedGameObjects.Length == 0 || selectedGameObjects[0] == previousSelectedGameObject || selectedGameObjects[0].activeInHierarchy == false) { return; } else if (ScriptDataService.GetCurrentScript().IsInstance) { ScriptDataService.CloseCurrentConstellationInstance(); previousSelectedGameObject = selectedGameObjects[0]; //RequestSetup(); } var selectedConstellation = selectedGameObjects[0].GetComponent <ConstellationEditable>() as ConstellationEditable; if (selectedConstellation != null) { currentEditableConstellation = selectedConstellation; previousSelectedGameObject = selectedGameObjects[0]; OpenConstellationInstance(selectedConstellation.GetConstellation(), AssetDatabase.GetAssetPath(selectedConstellation.GetConstellationData())); if (selectedConstellation.GetConstellation() == null) { return; } selectedConstellation.Initialize(); } } else { previousSelectedGameObject = null; } }