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
|
||||
|
||||
@@ -147,9 +147,8 @@ UnityPluginLoad(IUnityInterfaces* unityInterfaces)
|
||||
Logger::Log("UnityPluginLoad: Vulkan initialization failed, falling back to OpenGL");
|
||||
}
|
||||
|
||||
// Fall back to OpenGL for GLES renderers
|
||||
if (g_rendererType == kUnityGfxRendererOpenGLES20 ||
|
||||
g_rendererType == kUnityGfxRendererOpenGLES30)
|
||||
// Fall back to OpenGL for GLES renderer (Unity 6+ only supports GLES 3.0+)
|
||||
if (g_rendererType == kUnityGfxRendererOpenGLES30)
|
||||
{
|
||||
g_backend = std::make_unique<OpenGLTextureBackend>();
|
||||
Logger::Log("UnityPluginLoad: Using OpenGL backend");
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 092ff7f6b468e514dab68477b30f4be9
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 3
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
Android:
|
||||
enabled: 0
|
||||
settings:
|
||||
AndroidLibraryDependee: UnityLibrary
|
||||
AndroidSharedLibraryType: Executable
|
||||
CPU: ARMv7
|
||||
Any:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude WebGL: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Editor:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
Linux64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86_64
|
||||
OSXUniversal:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
Win:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86
|
||||
Win64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,54 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8beb8fd09587222468253575f4948166
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 3
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
Android:
|
||||
enabled: 0
|
||||
settings:
|
||||
AndroidLibraryDependee: UnityLibrary
|
||||
AndroidSharedLibraryType: Executable
|
||||
CPU: ARMv7
|
||||
Any:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude WebGL: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Editor:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
Linux64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86_64
|
||||
OSXUniversal:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
Win:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86
|
||||
Win64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,54 @@
|
||||
fileFormatVersion: 2
|
||||
guid: dee5496676a3922418f28bb82b40deb2
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 3
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
Android:
|
||||
enabled: 0
|
||||
settings:
|
||||
AndroidLibraryDependee: UnityLibrary
|
||||
AndroidSharedLibraryType: Executable
|
||||
CPU: ARMv7
|
||||
Any:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude WebGL: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Editor:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
Linux64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86_64
|
||||
OSXUniversal:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
Win:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86
|
||||
Win64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,54 @@
|
||||
fileFormatVersion: 2
|
||||
guid: d9d24fbb4dd465f4a94e1e6cca970a1b
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 3
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
Android:
|
||||
enabled: 0
|
||||
settings:
|
||||
AndroidLibraryDependee: UnityLibrary
|
||||
AndroidSharedLibraryType: Executable
|
||||
CPU: ARMv7
|
||||
Any:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude WebGL: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Editor:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
Linux64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86_64
|
||||
OSXUniversal:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
Win:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86
|
||||
Win64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -3,6 +3,7 @@
|
||||
#include "texture_backend.h"
|
||||
#include <vulkan/vulkan.h>
|
||||
#include <vulkan/vulkan_android.h>
|
||||
#include <IUnityRenderingExtensions.h>
|
||||
#include <IUnityGraphicsVulkan.h>
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a9e35fcc5dd576f5b95f2f7ddb081b2c
|
||||
PluginImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 3
|
||||
iconMap: {}
|
||||
executionOrder: {}
|
||||
defineConstraints: []
|
||||
isPreloaded: 0
|
||||
isOverridable: 0
|
||||
isExplicitlyReferenced: 0
|
||||
validateReferences: 1
|
||||
platformData:
|
||||
Android:
|
||||
enabled: 0
|
||||
settings:
|
||||
AndroidLibraryDependee: UnityLibrary
|
||||
AndroidSharedLibraryType: Executable
|
||||
CPU: ARMv7
|
||||
Any:
|
||||
enabled: 0
|
||||
settings:
|
||||
Exclude Android: 1
|
||||
Exclude Editor: 1
|
||||
Exclude Linux64: 1
|
||||
Exclude OSXUniversal: 1
|
||||
Exclude WebGL: 1
|
||||
Exclude Win: 1
|
||||
Exclude Win64: 1
|
||||
Editor:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: AnyCPU
|
||||
DefaultValueInitialized: true
|
||||
OS: AnyOS
|
||||
Linux64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86_64
|
||||
OSXUniversal:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
Win:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: x86
|
||||
Win64:
|
||||
enabled: 0
|
||||
settings:
|
||||
CPU: None
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -48,16 +48,46 @@ Packages/com.omarator.mosissdk/
|
||||
|
||||
## Build Commands
|
||||
|
||||
### Unity Build
|
||||
### Unity Build (Export to Android Studio)
|
||||
|
||||
Unity exports a Gradle project which is then built in Android Studio:
|
||||
|
||||
1. File > Build Settings
|
||||
2. Switch Platform to Android
|
||||
3. Player Settings > Other Settings:
|
||||
- Scripting Backend: IL2CPP
|
||||
- Target Architectures: ARM64
|
||||
- Graphics APIs: Vulkan, OpenGLES3 (in order of preference)
|
||||
- Minimum API Level: 29
|
||||
4. Build or Build and Run
|
||||
4. Check "Export Project"
|
||||
5. Click Export and select output folder (e.g., `D:\Dev\Mosis\Builds\Unity\Android\MosisVR`)
|
||||
|
||||
### Native Plugin Build
|
||||
### Build Gradle Project
|
||||
|
||||
After exporting from Unity:
|
||||
|
||||
```batch
|
||||
cd D:\Dev\Mosis\Builds\Unity\Android\MosisVR
|
||||
gradle assembleRelease
|
||||
|
||||
:: APK will be at:
|
||||
:: launcher\build\outputs\apk\release\launcher-release.apk
|
||||
```
|
||||
|
||||
Or open in Android Studio and build from there.
|
||||
|
||||
### Command Line Export (Optional)
|
||||
|
||||
```batch
|
||||
"C:\Program Files\Unity\Hub\Editor\6000.3.2f1\Editor\Unity.exe" ^
|
||||
-batchmode -quit -nographics ^
|
||||
-projectPath "D:\Dev\Mosis\MosisVR" ^
|
||||
-executeMethod BuildScript.BuildAndroidCI ^
|
||||
-outputPath "D:\Dev\Mosis\Builds\Unity\Android\MosisVR" ^
|
||||
-logFile "D:\Dev\Mosis\Builds\Unity\build.log"
|
||||
```
|
||||
|
||||
### Native Plugin Build (Manual)
|
||||
|
||||
To rebuild the native library manually:
|
||||
|
||||
|
||||
Reference in New Issue
Block a user