Skip to content

Commit ec72bde

Browse files
committed
Add functions for building PS5 and Xbox versions of game.
1 parent 287820c commit ec72bde

File tree

1 file changed

+67
-5
lines changed

1 file changed

+67
-5
lines changed

Assets/Scripts/EditorTools/Editor/BuildTools.cs

Lines changed: 67 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -591,7 +591,7 @@ public static void PostProcessMacOs()
591591
Debug.Log(" client.sh");
592592

593593
// Build boot.cfg
594-
var bootCfg = new string[]
594+
var bootCfg = new[]
595595
{
596596
"client",
597597
"load level_menu"
@@ -634,22 +634,84 @@ static void CreateBuildMacOs(bool useIL2CPP)
634634
PostProcessMacOs();
635635
}
636636

637-
[MenuItem("FPS Sample/BuildSystem/PS4/CreateBuildPS4")]
638-
public static void CreateBuildPS4()
637+
[MenuItem("FPS Sample/BuildSystem/PS5/CreateBuildPS5")]
638+
public static void CreateBuildPS5()
639639
{
640-
var target = BuildTarget.PS4;
640+
var target = BuildTarget.PS5;
641641
var buildName = GetBuildName();
642642
var buildPath = GetBuildPath(target, buildName);
643+
var bundlePath = GetBundlePath(target, buildPath);
643644
string executableName = Application.productName;
644645

645646
Directory.CreateDirectory(buildPath);
646-
BuildBundles(buildPath, target, true, true, true);
647+
BuildBundles(bundlePath, target, true, true, true);
647648
var res = BuildGame(buildPath, executableName, target, BuildOptions.None, buildName, false);
648649

649650
if (!res)
650651
throw new Exception("BuildPipeline.BuildPlayer failed");
651652
if (res.summary.result != UnityEditor.Build.Reporting.BuildResult.Succeeded)
652653
throw new Exception("BuildPipeline.BuildPlayer failed: " + res.ToString());
654+
655+
PostProcessBuildPS5();
656+
}
657+
658+
[MenuItem("FPS Sample/BuildSystem/PS5/PostProcessBuildPS5")]
659+
public static void PostProcessBuildPS5()
660+
{
661+
var target = BuildTarget.PS5;
662+
var buildName = GetBuildName();
663+
var buildPath = GetBuildPath(target, buildName);
664+
var bootcfgPath = buildPath + "/Build/Media/StreamingAssets/" + Game.k_BootConfigFilename;
665+
666+
// Build boot.cfg
667+
var bootCfg = new[]
668+
{
669+
"client 10.33.32.73"
670+
};
671+
672+
File.WriteAllLines(bootcfgPath, bootCfg);
673+
Debug.Log(" " + Game.k_BootConfigFilename);
674+
}
675+
676+
[MenuItem("FPS Sample/BuildSystem/Xbox/CreateBuildXbox")]
677+
public static void CreateBuildXbox()
678+
{
679+
var target = BuildTarget.GameCoreXboxSeries;
680+
var buildName = GetBuildName();
681+
var buildPath = GetBuildPath(target, buildName);
682+
var bundlePath = GetBundlePath(target, buildPath);
683+
string executableName = Application.productName;
684+
685+
Directory.CreateDirectory(buildPath);
686+
BuildBundles(bundlePath, target, true, true, true);
687+
var res = BuildGame(buildPath, executableName, target, BuildOptions.None, buildName, false);
688+
689+
if (!res)
690+
throw new Exception("BuildPipeline.BuildPlayer failed");
691+
if (res.summary.result != UnityEditor.Build.Reporting.BuildResult.Succeeded)
692+
throw new Exception("BuildPipeline.BuildPlayer failed: " + res.ToString());
693+
694+
PostProcessBuildXbox();
695+
}
696+
697+
[MenuItem("FPS Sample/BuildSystem/Xbox/PostProcessBuildXbox")]
698+
public static void PostProcessBuildXbox()
699+
{
700+
var target = BuildTarget.GameCoreXboxSeries;
701+
var buildName = GetBuildName();
702+
var buildPath = GetBuildPath(target, buildName);
703+
var bootcfgPath = GetBundlePath(target, buildPath) + "/" + Game.k_BootConfigFilename;
704+
705+
// Build boot.cfg
706+
//"client 10.33.32.14"
707+
var bootCfg = new[]
708+
{
709+
"client 10.33.32.14",
710+
//"load level_menu"
711+
};
712+
713+
File.WriteAllLines(bootcfgPath, bootCfg);
714+
Debug.Log(" " + "Writing " + bootcfgPath);
653715
}
654716

655717
[MenuItem("FPS Sample/BuildSystem/Linux64/PostProcess")]

0 commit comments

Comments
 (0)