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 44using UnityEditor ;
55using UnityEditor . Build . Reporting ;
66using UnityEngine ;
7+ using UnityEngine . TestTools ;
78
89namespace Unity . Netcode . EditorTests
910{
@@ -16,13 +17,25 @@ public void BasicBuildTest()
1617 {
1718 var execAssembly = Assembly . GetExecutingAssembly ( ) ;
1819 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+
1924 var buildReport = BuildPipeline . BuildPlayer (
2025 new [ ] { Path . Combine ( packagePath , DefaultBuildScenePath ) } ,
2126 Path . Combine ( Path . GetDirectoryName ( Application . dataPath ) , "Builds" , nameof ( BuildTests ) ) ,
22- EditorUserBuildSettings . activeBuildTarget ,
27+ buildTarget ,
2328 BuildOptions . None
2429 ) ;
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+ }
2639 }
2740 }
2841}
You can’t perform that action at this time.
0 commit comments