File tree Expand file tree Collapse file tree 1 file changed +15
-2
lines changed
com.unity.netcode.gameobjects/Tests/Editor/Build Expand file tree Collapse file tree 1 file changed +15
-2
lines changed Original file line number Diff line number Diff line change 4
4
using UnityEditor ;
5
5
using UnityEditor . Build . Reporting ;
6
6
using UnityEngine ;
7
+ using UnityEngine . TestTools ;
7
8
8
9
namespace Unity . Netcode . EditorTests
9
10
{
@@ -16,13 +17,25 @@ public void BasicBuildTest()
16
17
{
17
18
var execAssembly = Assembly . GetExecutingAssembly ( ) ;
18
19
var packagePath = UnityEditor . PackageManager . PackageInfo . FindForAssembly ( execAssembly ) . assetPath ;
20
+ var buildTarget = EditorUserBuildSettings . activeBuildTarget ;
21
+ var buildTargetGroup = BuildPipeline . GetBuildTargetGroup ( buildTarget ) ;
22
+ var buildTargetSupported = BuildPipeline . IsBuildTargetSupported ( buildTargetGroup , buildTarget ) ;
23
+
19
24
var buildReport = BuildPipeline . BuildPlayer (
20
25
new [ ] { Path . Combine ( packagePath , DefaultBuildScenePath ) } ,
21
26
Path . Combine ( Path . GetDirectoryName ( Application . dataPath ) , "Builds" , nameof ( BuildTests ) ) ,
22
- EditorUserBuildSettings . activeBuildTarget ,
27
+ buildTarget ,
23
28
BuildOptions . None
24
29
) ;
25
- Assert . AreEqual ( BuildResult . Succeeded , buildReport . summary . result ) ;
30
+
31
+ if ( buildTargetSupported )
32
+ {
33
+ Assert . AreEqual ( BuildResult . Succeeded , buildReport . summary . result ) ;
34
+ }
35
+ else
36
+ {
37
+ LogAssert . Expect ( LogType . Error , "Error building player because build target was unsupported" ) ;
38
+ }
26
39
}
27
40
}
28
41
}
You can’t perform that action at this time.
0 commit comments