0.6.6: Fixed issues with both canvas and scene picker

* Scene: Fixed issue, where scene picker wouldn't update correctly, when in play mode and changing active scene
* Canvas: Fixed issue, where it wasn't possible to select canvas in prefab stage
This commit is contained in:
Anders Ejlersen 2021-09-04 22:54:11 +02:00
parent b07117c9bf
commit 63f2101917
6 changed files with 50 additions and 8 deletions

View file

@ -1,6 +1,7 @@
using System.Collections.Generic;
using JetBrains.Annotations;
using UnityEditor;
using UnityEditor.Experimental.SceneManagement;
using UnityEditorInternal;
using UnityEngine;
using UTools = UnityEditor.Tools;
@ -22,7 +23,9 @@ namespace Game.NavigationTool.Editor.Tools
if (!IS_DIRTY)
return;
Canvas[] canvases = Object.FindObjectsOfType<Canvas>();
PrefabStage prefabStage = PrefabStageUtility.GetCurrentPrefabStage();
Canvas[] canvases = prefabStage != null ? prefabStage.prefabContentsRoot.GetComponentsInParent<Canvas>() : Object.FindObjectsOfType<Canvas>();
var list = new List<Canvas>(canvases.Length);
var listNames = new List<string>(canvases.Length);
var listIds = new List<int>(canvases.Length);
@ -65,10 +68,10 @@ namespace Game.NavigationTool.Editor.Tools
{
return 100.0f;
}
private static void Focus(int instanceId)
{
var obj = EditorUtility.InstanceIDToObject(instanceId);
Object obj = EditorUtility.InstanceIDToObject(instanceId);
var canvas = obj as Canvas;
if (canvas == null)