void SetupBreadCrumbBarIfNeeded() { if (m_BreadcrumbInitialized) { return; } var history = StageNavigationManager.instance.stageHistory; var crumbs = new List <BreadcrumbBar.Item>(); Texture sceneIcon = EditorGUIUtility.FindTexture("UnityEditor/SceneAsset Icon"); foreach (var stage in history) { bool isLastCrumb = stage == history.Last(); var label = stage.displayName; var icon = sceneIcon; var style = isLastCrumb ? BreadcrumbBar.DefaultStyles.labelBold : BreadcrumbBar.DefaultStyles.label; var tooltip = ""; if (stage.isPrefabStage) { icon = isLastCrumb ? PrefabStageUtility.GetCurrentPrefabStage().prefabFileIcon : stage.prefabIcon; if (!stage.prefabAssetExists) { style = isLastCrumb ? BreadcrumbBar.DefaultStyles.labelBoldMissing : BreadcrumbBar.DefaultStyles.labelMissing; tooltip = L10n.Tr("Prefab asset has been deleted"); } } crumbs.Add(new BreadcrumbBar.Item { content = new GUIContent(label, icon, tooltip), guistyle = style, userdata = stage }); } m_BreadcrumbBar.SetBreadCrumbs(crumbs); m_BreadcrumbBar.onBreadCrumbClicked -= BreadCrumbItemClicked; m_BreadcrumbBar.onBreadCrumbClicked += BreadCrumbItemClicked; m_BreadcrumbInitialized = true; bool isRootFolder; m_IsPrefabInValidAssetFolder = AssetDatabase.GetAssetFolderInfo(StageNavigationManager.instance.currentItem.prefabAssetPath, out isRootFolder, out m_IsPrefabInImmutableFolder); }
void SetupBreadCrumbBarIfNeeded() { if (m_BreadcrumbInitialized) { return; } var history = StageNavigationManager.instance.stageHistory; var crumbs = new List <BreadcrumbBar.Item>(); foreach (var stage in history) { var breadcrumbItem = stage.CreateBreadcrumbItem(); if (breadcrumbItem != null) { breadcrumbItem.userdata = stage; crumbs.Add(breadcrumbItem); } } m_BreadcrumbBar.SetBreadCrumbs(crumbs); m_BreadcrumbBar.onBreadCrumbClicked -= BreadCrumbItemClicked; m_BreadcrumbBar.onBreadCrumbClicked += BreadCrumbItemClicked; m_BreadcrumbInitialized = true; }