wip
This commit is contained in:
8
Assets/Editor.meta
Normal file
8
Assets/Editor.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 0efda6ff42873474696871462e328ff4
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
95
Assets/Editor/BuildScript.cs
Normal file
95
Assets/Editor/BuildScript.cs
Normal file
@@ -0,0 +1,95 @@
|
||||
using UnityEditor;
|
||||
using UnityEditor.Build.Reporting;
|
||||
using UnityEngine;
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
public class BuildScript
|
||||
{
|
||||
private static string[] GetScenes()
|
||||
{
|
||||
var scenes = new string[EditorBuildSettings.scenes.Length];
|
||||
for (int i = 0; i < EditorBuildSettings.scenes.Length; i++)
|
||||
{
|
||||
scenes[i] = EditorBuildSettings.scenes[i].path;
|
||||
}
|
||||
return scenes;
|
||||
}
|
||||
|
||||
[MenuItem("Build/Build Android APK")]
|
||||
public static void BuildAndroid()
|
||||
{
|
||||
string outputPath = GetOutputPath();
|
||||
BuildAndroidTo(outputPath);
|
||||
}
|
||||
|
||||
public static void BuildAndroidCI()
|
||||
{
|
||||
// Called from command line
|
||||
string outputPath = GetCommandLineArg("-outputPath");
|
||||
if (string.IsNullOrEmpty(outputPath))
|
||||
{
|
||||
outputPath = Path.Combine(Directory.GetCurrentDirectory(), "Builds", "Android", "MosisVR.apk");
|
||||
}
|
||||
|
||||
BuildAndroidTo(outputPath);
|
||||
}
|
||||
|
||||
private static void BuildAndroidTo(string outputPath)
|
||||
{
|
||||
// Ensure output directory exists
|
||||
string outputDir = Path.GetDirectoryName(outputPath);
|
||||
if (!Directory.Exists(outputDir))
|
||||
{
|
||||
Directory.CreateDirectory(outputDir);
|
||||
}
|
||||
|
||||
Debug.Log($"Building Android APK to: {outputPath}");
|
||||
|
||||
// Configure Android settings - export as Gradle project for manual build
|
||||
EditorUserBuildSettings.exportAsGoogleAndroidProject = true;
|
||||
EditorUserBuildSettings.buildAppBundle = false;
|
||||
PlayerSettings.SetScriptingBackend(BuildTargetGroup.Android, ScriptingImplementation.IL2CPP);
|
||||
PlayerSettings.Android.targetArchitectures = AndroidArchitecture.ARM64;
|
||||
|
||||
BuildPlayerOptions buildOptions = new BuildPlayerOptions
|
||||
{
|
||||
scenes = GetScenes(),
|
||||
locationPathName = outputPath,
|
||||
target = BuildTarget.Android,
|
||||
options = BuildOptions.None
|
||||
};
|
||||
|
||||
BuildReport report = BuildPipeline.BuildPlayer(buildOptions);
|
||||
BuildSummary summary = report.summary;
|
||||
|
||||
if (summary.result == BuildResult.Succeeded)
|
||||
{
|
||||
Debug.Log($"Build succeeded: {summary.totalSize} bytes, {summary.totalTime}");
|
||||
}
|
||||
else if (summary.result == BuildResult.Failed)
|
||||
{
|
||||
Debug.LogError("Build failed!");
|
||||
EditorApplication.Exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
private static string GetOutputPath()
|
||||
{
|
||||
// Default output path for menu builds
|
||||
return Path.Combine(Directory.GetCurrentDirectory(), "Builds", "Android", "MosisVR.apk");
|
||||
}
|
||||
|
||||
private static string GetCommandLineArg(string name)
|
||||
{
|
||||
string[] args = Environment.GetCommandLineArgs();
|
||||
for (int i = 0; i < args.Length; i++)
|
||||
{
|
||||
if (args[i] == name && i + 1 < args.Length)
|
||||
{
|
||||
return args[i + 1];
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
2
Assets/Editor/BuildScript.cs.meta
Normal file
2
Assets/Editor/BuildScript.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c0144fdab48cbb94eb8ac9a438073cc3
|
||||
@@ -11,7 +11,7 @@ MonoBehaviour:
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: e2b12afd4d27418a9cfb2823fe2b9ff3, type: 3}
|
||||
m_Name: XRSimulationRuntimeSettings
|
||||
m_EditorClassIdentifier:
|
||||
m_EditorClassIdentifier: Unity.XR.Simulation::UnityEngine.XR.Simulation.XRSimulationRuntimeSettings
|
||||
m_EnvironmentLayer: 30
|
||||
m_EnvironmentScanParams:
|
||||
m_MinimumRescanTime: 0.1
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 636aead6dcbe25d4c9db468ea608b06d
|
||||
guid: bc790a5322bc11747a8c3bd3b4cbc615
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
|
||||
8
Assets/XR/Temp.meta
Normal file
8
Assets/XR/Temp.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f441917a4e2f68141ad5568a4b4c0400
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -11,8 +11,8 @@ MonoBehaviour:
|
||||
m_EditorHideFlags: 0
|
||||
m_Script: {fileID: 11500000, guid: b2f528b98f844ed8b6b2d5fdf90b40e6, type: 3}
|
||||
m_Name: XRSimulationPreferences
|
||||
m_EditorClassIdentifier:
|
||||
m_HasInputActionUpgrade: 1
|
||||
m_EditorClassIdentifier: Unity.XR.Simulation::UnityEngine.XR.Simulation.XRSimulationPreferences
|
||||
m_HasInputActionUpgrade: 0
|
||||
m_EnvironmentPrefab: {fileID: 0}
|
||||
m_FallbackEnvironmentPrefab: {fileID: 7576867131100388943, guid: c7b92c392902f4043a03a64032c02fe1, type: 3}
|
||||
m_UnlockInputActionReference: {fileID: -6503468053843192148, guid: 1dd796eaee8744b4aa41b3f8bf5df64f, type: 3}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
fileFormatVersion: 2
|
||||
guid: eb628d5516bf1f8458789e267fbc6680
|
||||
guid: 860bbd1ea6fcfdf40b9bc5d802f8084d
|
||||
NativeFormatImporter:
|
||||
externalObjects: {}
|
||||
mainObjectFileID: 11400000
|
||||
|
||||
Reference in New Issue
Block a user