|
3 | 3 | // https://unity3d.com/legal/licenses/Unity_Reference_Only_License
|
4 | 4 |
|
5 | 5 | using UnityEngine;
|
| 6 | +using System; |
6 | 7 | using System.Collections.Generic;
|
7 | 8 | using DiscoveredTargetInfo = UnityEditor.BuildTargetDiscovery.DiscoveredTargetInfo;
|
8 | 9 | using TargetAttributes = UnityEditor.BuildTargetDiscovery.TargetAttributes;
|
9 | 10 |
|
10 | 11 | namespace UnityEditor.Build
|
11 | 12 | {
|
12 | 13 | // All settings for a build platform.
|
13 |
| - internal class BuildPlatform |
| 14 | + internal class BuildPlatform : ICloneable |
14 | 15 | {
|
15 | 16 | // short name used for texture settings, etc.
|
16 | 17 | public string name;
|
@@ -38,13 +39,24 @@ public BuildPlatform(string locTitle, string tooltip, string iconId, NamedBuildT
|
38 | 39 | {
|
39 | 40 | this.namedBuildTarget = namedBuildTarget;
|
40 | 41 | name = namedBuildTarget.TargetName;
|
41 |
| - m_Title = new ScalableGUIContent(locTitle, null, iconId); |
| 42 | + |
| 43 | + // Workaround for some platforms which have | in their name which is also used as separator for tooltips |
| 44 | + if (locTitle.Contains("|")) |
| 45 | + m_Title = new ScalableGUIContent(locTitle.Replace("|", " "), null, iconId); |
| 46 | + else |
| 47 | + m_Title = new ScalableGUIContent(locTitle, null, iconId); |
| 48 | + |
42 | 49 | m_SmallTitle = new ScalableGUIContent(null, null, iconId + ".Small");
|
43 | 50 | this.tooltip = tooltip;
|
44 | 51 | this.hideInUi = hideInUi;
|
45 | 52 | this.defaultTarget = defaultTarget;
|
46 | 53 | this.installed = installed;
|
47 | 54 | }
|
| 55 | + |
| 56 | + public object Clone() |
| 57 | + { |
| 58 | + return MemberwiseClone(); |
| 59 | + } |
48 | 60 | }
|
49 | 61 |
|
50 | 62 | internal class BuildPlatformWithSubtarget : BuildPlatform
|
@@ -132,29 +144,10 @@ public string GetBuildTargetDisplayName(NamedBuildTarget namedBuildTarget, Build
|
132 | 144 | }
|
133 | 145 |
|
134 | 146 | var suffix = namedBuildTarget == NamedBuildTarget.Server ? " Server" : "";
|
135 |
| - |
136 |
| - switch (target) |
137 |
| - { |
138 |
| - case BuildTarget.StandaloneWindows: |
139 |
| - case BuildTarget.StandaloneWindows64: |
140 |
| - return $"Windows{suffix}"; |
141 |
| - case BuildTarget.StandaloneOSX: |
142 |
| - // Deprecated |
143 |
| -#pragma warning disable 612, 618 |
144 |
| - case BuildTarget.StandaloneOSXIntel: |
145 |
| - case BuildTarget.StandaloneOSXIntel64: |
146 |
| -#pragma warning restore 612, 618 |
147 |
| - return $"macOS{suffix}"; |
148 |
| - // Deprecated |
149 |
| -#pragma warning disable 612, 618 |
150 |
| - case BuildTarget.StandaloneLinux: |
151 |
| - case BuildTarget.StandaloneLinuxUniversal: |
152 |
| -#pragma warning restore 612, 618 |
153 |
| - case BuildTarget.StandaloneLinux64: |
154 |
| - return $"Linux{suffix}"; |
155 |
| - } |
156 |
| - |
157 |
| - return "Unsupported Target"; |
| 147 | +#pragma warning disable CS0618 // Member is obsolete |
| 148 | + string targetName = BuildTargetDiscovery.BuildPlatformDisplayName(target) + suffix; |
| 149 | +#pragma warning restore CS0618 |
| 150 | + return targetName.Length == 0 ? "Unsupported Target" : targetName; |
158 | 151 | }
|
159 | 152 |
|
160 | 153 | public string GetModuleDisplayName(NamedBuildTarget namedBuildTarget, BuildTarget buildTarget)
|
|
0 commit comments