internal static string BuildMainWindowTitle() { var activeSceneName = L10n.Tr("Untitled"); if (!string.IsNullOrEmpty(SceneManager.GetActiveScene().path)) { activeSceneName = Path.GetFileNameWithoutExtension(SceneManager.GetActiveScene().path); } var desc = new ApplicationTitleDescriptor( isTemporaryProject ? PlayerSettings.productName : Path.GetFileName(Path.GetDirectoryName(Application.dataPath)), InternalEditorUtility.GetUnityDisplayVersion(), activeSceneName, GetLicenseType(), isPreviewPackageInUse, BuildPipeline.GetBuildTargetGroupDisplayName(BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget)), Coverage.enabled ); desc.title = GetDefaultMainWindowTitle(desc); updateMainWindowTitle?.Invoke(desc); return(desc.title); }
static void SetProfilerWindowTitle(ApplicationTitleDescriptor desc) { if (s_SlaveProfilerWindow == null) return; if (s_SlaveProfilerWindow.IsRecording()) { var playStateHint = !ProfilerDriver.profileEditor ? "PLAY" : "EDIT"; desc.title = $"Profiler [RECORDING {playStateHint}] - {desc.projectName} - {desc.unityVersion}"; } else desc.title = $"Profiler - {desc.projectName} - {desc.unityVersion}"; }
internal static string GetDefaultMainWindowTitle(ApplicationTitleDescriptor desc) { // de facto dev tool window title conventions: // https://unity.slack.com/archives/C06TQ0QMQ/p1550046908037800 // // _windows_ & _linux_ // // <Project> - <ThingImEditing> [- <MaybeSomeBuildConfigStuff>] - <AppName> [<ProbablyVersionToo>] // // this is done to keep the most important data at the front to deal with truncation that happens // in various interfaces like alt-tab and hover taskbar icon. // // _mac_ // // <ThingImEditing> - <Project> [- <MaybeSomeBuildConfigStuff>] - <AppName> [<ProbablyVersionToo>] // // most macOS apps show the icon of "ThingImEditing" in front of the title, so it makes sense // for the icon to be next to what it represents. (Unity does not currently show the icon though.) // var title = Application.platform == RuntimePlatform.OSXEditor ? $"{desc.activeSceneName} - {desc.projectName}" : $"{desc.projectName} - {desc.activeSceneName}"; // FUTURE: [PREVIEW PACKAGES IN USE], [CODE COVERAGE] and the build target info do not belong in the title bar. they // are there now because we want them to be always-visible to user, which normally would be a) buildconfig // bar or b) status bar, but we don't have a) and our b) needs work to support such a thing. if (!string.IsNullOrEmpty(desc.targetName)) { title += $" - {desc.targetName}"; } title += $" - Unity {desc.unityVersion}"; if (!string.IsNullOrEmpty(desc.licenseType)) { title += $" {desc.licenseType}"; } if (desc.previewPackageInUse) { title += " " + L10n.Tr("[PREVIEW PACKAGES IN USE]"); } if (desc.codeCoverageEnabled) { title += " " + L10n.Tr("[CODE COVERAGE]"); } return(title); }
static void SetProfilerWindowTitle(ApplicationTitleDescriptor desc) { if (s_SlaveProfilerWindow == null) { return; } if (s_SlaveProfilerWindow.IsRecording()) { desc.title = $"Profiler [RECORDING {s_MasterPlayStateHint}] - {desc.projectName} - {desc.unityVersion}"; } else { desc.title = $"Profiler - {desc.projectName} - {desc.unityVersion}"; } }
private void UpdateSafeModeTitle(ApplicationTitleDescriptor desc) { desc.title = $"{desc.projectName} - SAFE MODE - {desc.unityVersion}"; }