@@ -15,6 +15,7 @@ internal class BuildPlatform
1515 // short name used for texture settings, etc.
1616 public string name ;
1717 public NamedBuildTarget namedBuildTarget ;
18+ public bool installed ;
1819 public bool hideInUi ;
1920 public string tooltip ;
2021 public BuildTarget defaultTarget ;
@@ -28,12 +29,12 @@ internal class BuildPlatform
2829 public GUIContent title => m_Title ;
2930 public Texture2D smallIcon => ( ( GUIContent ) m_SmallTitle ) . image as Texture2D ;
3031
31- public BuildPlatform ( string locTitle , string iconId , NamedBuildTarget namedBuildTarget , BuildTarget defaultTarget , bool hideInUi )
32- : this ( locTitle , "" , iconId , namedBuildTarget , defaultTarget , hideInUi )
32+ public BuildPlatform ( string locTitle , string iconId , NamedBuildTarget namedBuildTarget , BuildTarget defaultTarget , bool hideInUi , bool installed )
33+ : this ( locTitle , "" , iconId , namedBuildTarget , defaultTarget , hideInUi , installed )
3334 {
3435 }
3536
36- public BuildPlatform ( string locTitle , string tooltip , string iconId , NamedBuildTarget namedBuildTarget , BuildTarget defaultTarget , bool hideInUi )
37+ public BuildPlatform ( string locTitle , string tooltip , string iconId , NamedBuildTarget namedBuildTarget , BuildTarget defaultTarget , bool hideInUi , bool installed )
3738 {
3839 this . namedBuildTarget = namedBuildTarget ;
3940 name = namedBuildTarget . TargetName ;
@@ -42,15 +43,16 @@ public BuildPlatform(string locTitle, string tooltip, string iconId, NamedBuildT
4243 this . tooltip = tooltip ;
4344 this . hideInUi = hideInUi ;
4445 this . defaultTarget = defaultTarget ;
46+ this . installed = installed ;
4547 }
4648 }
4749
4850 internal class BuildPlatformWithSubtarget : BuildPlatform
4951 {
5052 public int subtarget ;
5153
52- public BuildPlatformWithSubtarget ( string locTitle , string tooltip , string iconId , NamedBuildTarget namedBuildTarget , BuildTarget defaultTarget , int subtarget , bool forceShowTarget )
53- : base ( locTitle , tooltip , iconId , namedBuildTarget , defaultTarget , forceShowTarget )
54+ public BuildPlatformWithSubtarget ( string locTitle , string tooltip , string iconId , NamedBuildTarget namedBuildTarget , BuildTarget defaultTarget , int subtarget , bool hideInUi , bool installed )
55+ : base ( locTitle , tooltip , iconId , namedBuildTarget , defaultTarget , hideInUi , installed )
5456 {
5557 this . subtarget = subtarget ;
5658 name = namedBuildTarget . TargetName ;
@@ -80,10 +82,13 @@ internal BuildPlatforms()
8082 standaloneTarget = BuildTarget . StandaloneLinux64 ;
8183
8284 buildPlatformsList . Add ( new BuildPlatformWithSubtarget ( BuildPipeline . GetBuildTargetGroupDisplayName ( BuildTargetGroup . Standalone ) , "" , "BuildSettings.Standalone" ,
83- NamedBuildTarget . Standalone , standaloneTarget , ( int ) StandaloneBuildSubtarget . Player , true ) ) ;
85+ NamedBuildTarget . Standalone , standaloneTarget , ( int ) StandaloneBuildSubtarget . Player , false , true ) ) ;
8486
87+ // TODO: We should consider extend BuildTargetDiscovery to support named targets and subtargets,
88+ // specially if at some point other platforms use them.
89+ // The installed value is set by the linux, mac or win ExtensionModule.cs when they are loaded.
8590 buildPlatformsList . Add ( new BuildPlatformWithSubtarget ( "Dedicated Server" , "" , "BuildSettings.DedicatedServer" ,
86- NamedBuildTarget . Server , standaloneTarget , ( int ) StandaloneBuildSubtarget . Server , true ) ) ;
91+ NamedBuildTarget . Server , standaloneTarget , ( int ) StandaloneBuildSubtarget . Server , false , false ) ) ;
8792
8893 foreach ( var target in buildTargets )
8994 {
@@ -95,7 +100,8 @@ internal BuildPlatforms()
95100 target . iconName ,
96101 namedBuildTarget ,
97102 target . buildTargetPlatformVal ,
98- target . HasFlag ( TargetAttributes . HideInUI ) ) ) ;
103+ hideInUi : target . HasFlag ( TargetAttributes . HideInUI ) ,
104+ installed : BuildPipeline . GetPlaybackEngineDirectory ( target . buildTargetPlatformVal , BuildOptions . None , false ) != string . Empty ) ) ;
99105 }
100106 }
101107
@@ -174,7 +180,8 @@ public List<BuildPlatform> GetValidPlatforms(bool includeMetaPlatforms)
174180 {
175181 List < BuildPlatform > platforms = new List < BuildPlatform > ( ) ;
176182 foreach ( BuildPlatform bp in buildPlatforms )
177- if ( bp . namedBuildTarget == NamedBuildTarget . Standalone || BuildPipeline . IsBuildTargetSupported ( bp . namedBuildTarget . ToBuildTargetGroup ( ) , bp . defaultTarget ) )
183+ if ( bp . namedBuildTarget == NamedBuildTarget . Standalone ||
184+ ( bp . installed && BuildPipeline . IsBuildTargetSupported ( bp . namedBuildTarget . ToBuildTargetGroup ( ) , bp . defaultTarget ) ) )
178185 platforms . Add ( bp ) ;
179186
180187 return platforms ;
0 commit comments