1
0
mirror of https://github.com/xiaopeng12138/MaiDXR.git synced 2024-11-24 03:50:10 +01:00

remove ovr stuff; bump unity version; add windowsinput.dll

This commit is contained in:
xpeng 2024-01-08 21:40:45 +01:00
parent 72d8bceffc
commit 14c8b88b4e
529 changed files with 385 additions and 205209 deletions

1
.gitignore vendored
View File

@ -131,3 +131,4 @@ $RECYCLE.BIN/
# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)
config.json
uWindowCapture.log

Binary file not shown.

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 7f0b08ee6ec746544a1684d6d36214c7
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,578 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!1 &122432412
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 122432413}
- component: {fileID: 122432414}
m_Layer: 0
m_Name: RightEyeAnchor
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &122432413
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 122432412}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1654481609}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!20 &122432414
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 122432412}
m_Enabled: 0
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 2
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!1 &608780163
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 608780164}
m_Layer: 0
m_Name: TrackerAnchor
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &608780164
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 608780163}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1654481609}
m_RootOrder: 5
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1010144588
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1010144589}
m_Layer: 0
m_Name: RightControllerAnchor
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1010144589
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1010144588}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1521644926}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1103977314
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1103977315}
- component: {fileID: 1103977316}
m_Layer: 0
m_Name: LeftEyeAnchor
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1103977315
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1103977314}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1654481609}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!20 &1103977316
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1103977314}
m_Enabled: 0
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 1
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!1 &1174096078
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1174096079}
m_Layer: 0
m_Name: LeftControllerAnchor
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1174096079
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1174096078}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1814618716}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1255382394
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1255382395}
- component: {fileID: 1255382396}
m_Layer: 0
m_Name: CenterEyeAnchor
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1255382395
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1255382394}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 1654481609}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!20 &1255382396
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1255382394}
m_Enabled: 0
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!1 &1521644925
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1521644926}
m_Layer: 0
m_Name: RightHandAnchor
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1521644926
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1521644925}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1010144589}
m_Father: {fileID: 1654481609}
m_RootOrder: 4
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1654481608
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1654481609}
m_Layer: 0
m_Name: TrackingSpace
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1654481609
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1654481608}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1103977315}
- {fileID: 1255382395}
- {fileID: 122432413}
- {fileID: 1814618716}
- {fileID: 1521644926}
- {fileID: 608780164}
m_Father: {fileID: 7449411159797096978}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1814618715
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 1814618716}
m_Layer: 0
m_Name: LeftHandAnchor
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &1814618716
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1814618715}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1174096079}
m_Father: {fileID: 1654481609}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &342779316052413363
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6020623325241151543}
m_Layer: 0
m_Name: Oculus_MRC_XRT_Manager_Full
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &6020623325241151543
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 342779316052413363}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 7449411159797096978}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &7449411159797096982
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 7449411159797096978}
- component: {fileID: 7449411159797096981}
- component: {fileID: 7449411159797096980}
- component: {fileID: 7449411159797096983}
- component: {fileID: 1089416225}
m_Layer: 0
m_Name: OVRManager
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!4 &7449411159797096978
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7449411159797096982}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1654481609}
m_Father: {fileID: 6020623325241151543}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!114 &7449411159797096981
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7449411159797096982}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7e933e81d3c20c74ea6fdc708a67e3a5, type: 3}
m_Name:
m_EditorClassIdentifier:
useRecommendedMSAALevel: 1
_monoscopic: 0
enableAdaptiveResolution: 0
_colorGamut: 4
minRenderScale: 0.7
maxRenderScale: 1
_headPoseRelativeOffsetRotation: {x: 0, y: 0, z: 0}
_headPoseRelativeOffsetTranslation: {x: 0, y: 0, z: 0}
profilerTcpPort: 32419
expandMixedRealityCapturePropertySheet: 0
enableMixedReality: 0
compositionMethod: 0
extraHiddenLayers:
serializedVersion: 2
m_Bits: 0
extraVisibleLayers:
serializedVersion: 2
m_Bits: 0
dynamicCullingMask: 1
externalCompositionBackdropColorRift: {r: 0, g: 1, b: 0, a: 1}
externalCompositionBackdropColorQuest: {r: 0, g: 0, b: 0, a: 0}
capturingCameraDevice: 0
flipCameraFrameHorizontally: 0
flipCameraFrameVertically: 0
handPoseStateLatency: 0
sandwichCompositionRenderLatency: 0
sandwichCompositionBufferedFrames: 8
chromaKeyColor: {r: 0, g: 1, b: 0, a: 1}
chromaKeySimilarity: 0.6
chromaKeySmoothRange: 0.03
chromaKeySpillRange: 0.06
useDynamicLighting: 0
depthQuality: 1
dynamicLightingSmoothFactor: 8
dynamicLightingDepthVariationClampingValue: 0.001
virtualGreenScreenType: 0
virtualGreenScreenTopY: 10
virtualGreenScreenBottomY: -10
virtualGreenScreenApplyDepthCulling: 0
virtualGreenScreenDepthTolerance: 0.2
mrcActivationMode: 0
_trackingOriginType: 2
usePositionTracking: 1
useRotationTracking: 1
useIPDInPositionTracking: 1
resetTrackerOnLoad: 0
AllowRecenter: 0
LateControllerUpdate: 1
--- !u!114 &7449411159797096980
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7449411159797096982}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 7b7741adcaae3294c84769ebcfc8e8db, type: 3}
m_Name:
m_EditorClassIdentifier:
m_originalTransform: {fileID: 0}
--- !u!114 &7449411159797096983
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7449411159797096982}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 651f9b800d6cfba42a29be5f69653f86, type: 3}
m_Name:
m_EditorClassIdentifier:
--- !u!114 &1089416225
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7449411159797096982}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: df9f338034892c44ebb62d97894772f1, type: 3}
m_Name:
m_EditorClassIdentifier:
usePerEyeCameras: 0
useFixedUpdateForTracking: 0
disableEyeAnchorCameras: 1

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: be43049c7a9ba78498151d0539839267
PrefabImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 9e1946b037602d747a45693a7634efc6
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,30 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace MRCHelpers
{
/// <summary>
/// Copies the position of a transform every frame
/// </summary>
public class CopyTransform : MonoBehaviour
{
/// <summary>
/// The transform to follow
/// </summary>
[SerializeField]
private Transform m_originalTransform;
/// <summary>
/// Update
/// </summary>
void Update()
{
//copy the pose of the other transform each frame
transform.position = m_originalTransform.position;
transform.rotation = m_originalTransform.rotation;
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 7b7741adcaae3294c84769ebcfc8e8db
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,165 +0,0 @@
#if UNITY_ANDROID && !UNITY_EDITOR
#define OVR_ANDROID_MRC
#endif
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace MRCHelpers
{
/// <summary>
/// Triggers the Oculus MRC tracking engine if the scene uses the XR Interaction Toolkit.
/// The code is modified from the file OVRMixedRealityCaptureTest in Oculus plugin
/// </summary>
public class OVRMixedRealityCaptureTestMod : MonoBehaviour
{
bool inited = false;
public Camera defaultExternalCamera;
OVRPlugin.Fovf defaultFov;
// Use this for initialization
void Start()
{
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || OVR_ANDROID_MRC
if (!defaultExternalCamera)
{
Debug.LogWarning("defaultExternalCamera undefined");
}
#if !OVR_ANDROID_MRC
// On Quest, we enable MRC automatically through the configuration
if (!OVRManager.instance.enableMixedReality)
{
OVRManager.instance.enableMixedReality = true;
}
#endif
#endif
}
void Initialize()
{
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || OVR_ANDROID_MRC
if (inited)
return;
#if OVR_ANDROID_MRC
if (!OVRPlugin.Media.GetInitialized())
return;
#else
if (!OVRPlugin.IsMixedRealityInitialized())
return;
#endif
OVRPlugin.ResetDefaultExternalCamera();
Debug.LogFormat("GetExternalCameraCount before adding manual external camera {0}", OVRPlugin.GetExternalCameraCount());
UpdateDefaultExternalCamera();
Debug.LogFormat("GetExternalCameraCount after adding manual external camera {0}", OVRPlugin.GetExternalCameraCount());
// obtain default FOV
{
OVRPlugin.CameraIntrinsics cameraIntrinsics;
OVRPlugin.CameraExtrinsics cameraExtrinsics;
OVRPlugin.GetMixedRealityCameraInfo(0, out cameraExtrinsics, out cameraIntrinsics);
defaultFov = cameraIntrinsics.FOVPort;
}
inited = true;
#endif
}
void UpdateDefaultExternalCamera()
{
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || OVR_ANDROID_MRC
// always build a 1080p external camera
const int cameraPixelWidth = 1920;
const int cameraPixelHeight = 1080;
const float cameraAspect = (float)cameraPixelWidth / cameraPixelHeight;
string cameraName = "UnityExternalCamera";
OVRPlugin.CameraIntrinsics cameraIntrinsics = new OVRPlugin.CameraIntrinsics();
OVRPlugin.CameraExtrinsics cameraExtrinsics = new OVRPlugin.CameraExtrinsics();
// intrinsics
cameraIntrinsics.IsValid = OVRPlugin.Bool.True;
cameraIntrinsics.LastChangedTimeSeconds = Time.time;
float vFov = defaultExternalCamera.fieldOfView * Mathf.Deg2Rad;
float hFov = Mathf.Atan(Mathf.Tan(vFov * 0.5f) * cameraAspect) * 2.0f;
OVRPlugin.Fovf fov = new OVRPlugin.Fovf();
fov.UpTan = fov.DownTan = Mathf.Tan(vFov * 0.5f);
fov.LeftTan = fov.RightTan = Mathf.Tan(hFov * 0.5f);
cameraIntrinsics.FOVPort = fov;
cameraIntrinsics.VirtualNearPlaneDistanceMeters = defaultExternalCamera.nearClipPlane;
cameraIntrinsics.VirtualFarPlaneDistanceMeters = defaultExternalCamera.farClipPlane;
cameraIntrinsics.ImageSensorPixelResolution.w = cameraPixelWidth;
cameraIntrinsics.ImageSensorPixelResolution.h = cameraPixelHeight;
// extrinsics
cameraExtrinsics.IsValid = OVRPlugin.Bool.True;
cameraExtrinsics.LastChangedTimeSeconds = Time.time;
cameraExtrinsics.CameraStatusData = OVRPlugin.CameraStatus.CameraStatus_Calibrated;
cameraExtrinsics.AttachedToNode = OVRPlugin.Node.None;
Camera mainCamera = Camera.main;
Transform trackingSpace = Camera.main.transform.parent;
OVRPose trackingSpacePose = trackingSpace.ToOVRPose(false);
OVRPose cameraPose = defaultExternalCamera.transform.ToOVRPose(false);
OVRPose relativePose = trackingSpacePose.Inverse() * cameraPose;
#if OVR_ANDROID_MRC
OVRPose stageToLocalPose = OVRPlugin.GetTrackingTransformRelativePose(OVRPlugin.TrackingOrigin.Stage).ToOVRPose();
OVRPose localToStagePose = stageToLocalPose.Inverse();
relativePose = localToStagePose * relativePose;
#endif
cameraExtrinsics.RelativePose = relativePose.ToPosef();
if (!OVRPlugin.SetDefaultExternalCamera(cameraName, ref cameraIntrinsics, ref cameraExtrinsics))
{
Debug.LogError("SetDefaultExternalCamera() failed");
}
#endif
}
// Update is called once per frame
void Update()
{
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN || OVR_ANDROID_MRC
if (!inited)
{
Initialize();
return;
}
if (!defaultExternalCamera)
{
return;
}
#if OVR_ANDROID_MRC
if (!OVRPlugin.Media.GetInitialized())
{
return;
}
#else
if (!OVRPlugin.IsMixedRealityInitialized())
{
return;
}
#endif
UpdateDefaultExternalCamera();
OVRPlugin.OverrideExternalCameraFov(0, false, new OVRPlugin.Fovf());
OVRPlugin.OverrideExternalCameraStaticPose(0, false, OVRPlugin.Posef.identity);
#endif
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 911771ab916fc1b44a79218f8da31122
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,59 +0,0 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.SpatialTracking;
namespace MRCHelpers
{
/// <summary>
/// Removes the tracked pose driver in the cameras used for mixed reality capture.
/// Unity automatically adds it, and this way, the cameras follow the head of the
/// user, while they should be fixed in the world
/// </summary>
public class RemoveMRCamerasTracking : MonoBehaviour
{
/// <summary>
/// Start
/// </summary>
private void Start()
{
StartCoroutine(RemoveCamerasTracking());
}
/// <summary>
/// Coroutine to remove tracking scripts from cameras
/// </summary>
private IEnumerator RemoveCamerasTracking()
{
//get the tracking space child
Transform trackingSpaceTransform = transform.Find("TrackingSpace");
//the names of the cameras that Oculus adds for MRC
string[] camerasNames = new string[] { "OculusMRC_BackgroundCamera", "OculusMRC_ForgroundCamera" };
Transform tr = null;
//let everything initialize
yield return null;
var waiter = new WaitForSeconds(0.5f);
//I have noticed the system may re-created the cameras in some conditions
//(e.g. the player disconnects and reconnects with OBS), so we must keep deleting them forever
while (true)
{
//for each camera
foreach (string cameraName in camerasNames)
{
//find the camera, and destroy its TrackedPoseDriver if there is one attached
if ((tr = trackingSpaceTransform.Find(cameraName)) != null)
if (tr.GetComponent<TrackedPoseDriver>() != null)
Destroy(tr.GetComponent<TrackedPoseDriver>());
}
//wait a bit before looking again
yield return waiter;
}
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 651f9b800d6cfba42a29be5f69653f86
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,31 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 05d394ae2a81edd4cbc3c51917e766e3, type: 3}
m_Name: OculusProjectConfig
m_EditorClassIdentifier:
targetDeviceTypes: 0100000002000000
allowOptional3DofHeadTracking: 0
handTrackingSupport: 1
handTrackingFrequency: 2
handTrackingVersion: 2
anchorSupport: 0
renderModelSupport: 0
trackedKeyboardSupport: 0
disableBackups: 1
enableNSCConfig: 1
securityXmlPath:
skipUnneededShaders: 0
focusAware: 1
requiresSystemKeyboard: 0
experimentalFeaturesEnabled: 0
insightPassthroughEnabled: 1
systemSplashScreen: {fileID: 0}

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 646cfe6185d2a11488325d072785ba7c
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 2dd9b275c8a083f4aaeaa240b0045c89
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 095d7a3dae7d8ea4cb761651027164ce
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,22 +0,0 @@
fileFormatVersion: 2
guid: d716392289ac6764994885f5821f7d7b
AudioImporter:
externalObjects: {}
serializedVersion: 6
defaultSettings:
loadType: 0
sampleRateSetting: 0
sampleRateOverride: 44100
compressionFormat: 1
quality: 1
conversionMode: 0
platformSettingOverrides: {}
forceToMono: 0
normalize: 1
preloadAudioData: 1
loadInBackground: 0
ambisonic: 0
3D: 1
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,5 +0,0 @@
fileFormatVersion: 2
guid: 76c19abd24bec62459b5f0d26fdd9a85
folderAsset: yes
DefaultImporter:
userData:

View File

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
android:installLocation="auto">
<application
android:label="@string/app_name"
android:icon="@mipmap/app_icon">
<activity
android:theme="@android:style/Theme.Black.NoTitleBar.Fullscreen"
android:configChanges="locale|fontScale|keyboard|keyboardHidden|mcc|mnc|navigation|orientation|screenLayout|screenSize|smallestScreenSize|touchscreen|uiMode"
android:launchMode="singleTask"
android:name="com.unity3d.player.UnityPlayerActivity"
android:excludeFromRecents="true">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<meta-data android:name="unityplayer.SkipPermissionsDialog" android:value="false" />
<meta-data android:name="com.samsung.android.vr.application.mode" android:value="vr_only"/>
</application>
</manifest>

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 7a16cc136accf1f42bdc6f71f94b50ac
timeCreated: 1475710636
licenseType: Store
TextScriptImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,261 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* Licensed under the Oculus SDK License Agreement (the "License");
* you may not use the Oculus SDK except in compliance with the License,
* which is provided at the time of installation or download, or which
* otherwise accompanies this software in either electronic or hard copy form.
*
* You may obtain a copy of the License at
*
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Oculus SDK
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Text;
using System.Threading;
using UnityEngine;
using Debug = UnityEngine.Debug;
public class OVRADBTool
{
public bool isReady;
public string androidSdkRoot;
public string androidPlatformToolsPath;
public string adbPath;
public OVRADBTool(string androidSdkRoot)
{
if (!String.IsNullOrEmpty(androidSdkRoot))
{
this.androidSdkRoot = androidSdkRoot;
}
else
{
this.androidSdkRoot = String.Empty;
}
if (this.androidSdkRoot.EndsWith("\\") || this.androidSdkRoot.EndsWith("/"))
{
this.androidSdkRoot = this.androidSdkRoot.Remove(this.androidSdkRoot.Length - 1);
}
androidPlatformToolsPath = Path.Combine(this.androidSdkRoot, "platform-tools");
adbPath = Path.Combine(androidPlatformToolsPath, "adb.exe");
isReady = File.Exists(adbPath);
}
public static bool IsAndroidSdkRootValid(string androidSdkRoot)
{
OVRADBTool tool = new OVRADBTool(androidSdkRoot);
return tool.isReady;
}
public delegate void WaitingProcessToExitCallback();
public int StartServer(WaitingProcessToExitCallback waitingProcessToExitCallback)
{
string outputString;
string errorString;
int exitCode = RunCommand(new string[] { "start-server" }, waitingProcessToExitCallback, out outputString, out errorString);
return exitCode;
}
public int KillServer(WaitingProcessToExitCallback waitingProcessToExitCallback)
{
string outputString;
string errorString;
int exitCode = RunCommand(new string[] { "kill-server" }, waitingProcessToExitCallback, out outputString, out errorString);
return exitCode;
}
public int ForwardPort(int port, WaitingProcessToExitCallback waitingProcessToExitCallback)
{
string outputString;
string errorString;
string portString = string.Format("tcp:{0}", port);
int exitCode = RunCommand(new string[] { "forward", portString, portString }, waitingProcessToExitCallback, out outputString, out errorString);
return exitCode;
}
public int ReleasePort(int port, WaitingProcessToExitCallback waitingProcessToExitCallback)
{
string outputString;
string errorString;
string portString = string.Format("tcp:{0}", port);
int exitCode = RunCommand(new string[] { "forward", "--remove", portString }, waitingProcessToExitCallback, out outputString, out errorString);
return exitCode;
}
public List<string> GetDevices()
{
string outputString;
string errorString;
RunCommand(new string[] { "devices" }, null, out outputString, out errorString);
string[] devices = outputString.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
List<string> deviceList = new List<string>(devices);
deviceList.RemoveAt(0);
for(int i = 0; i < deviceList.Count; i++)
{
string deviceName = deviceList[i];
int index = deviceName.IndexOf('\t');
if (index >= 0)
deviceList[i] = deviceName.Substring(0, index);
else
deviceList[i] = "";
}
return deviceList;
}
private StringBuilder outputStringBuilder = null;
private StringBuilder errorStringBuilder = null;
public int RunCommand(string[] arguments, WaitingProcessToExitCallback waitingProcessToExitCallback, out string outputString, out string errorString)
{
int exitCode = -1;
if (!isReady)
{
Debug.LogWarning("OVRADBTool not ready");
outputString = string.Empty;
errorString = "OVRADBTool not ready";
return exitCode;
}
string args = string.Join(" ", arguments);
ProcessStartInfo startInfo = new ProcessStartInfo(adbPath, args);
startInfo.WorkingDirectory = androidSdkRoot;
startInfo.CreateNoWindow = true;
startInfo.UseShellExecute = false;
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardError = true;
outputStringBuilder = new StringBuilder("");
errorStringBuilder = new StringBuilder("");
Process process = Process.Start(startInfo);
process.OutputDataReceived += new DataReceivedEventHandler(OutputDataReceivedHandler);
process.ErrorDataReceived += new DataReceivedEventHandler(ErrorDataReceivedHandler);
process.BeginOutputReadLine();
process.BeginErrorReadLine();
try
{
do
{
if (waitingProcessToExitCallback != null)
{
waitingProcessToExitCallback();
}
} while (!process.WaitForExit(100));
process.WaitForExit();
}
catch (Exception e)
{
Debug.LogWarningFormat("[OVRADBTool.RunCommand] exception {0}", e.Message);
}
exitCode = process.ExitCode;
process.Close();
outputString = outputStringBuilder.ToString();
errorString = errorStringBuilder.ToString();
outputStringBuilder = null;
errorStringBuilder = null;
if (!string.IsNullOrEmpty(errorString))
{
if (errorString.Contains("Warning"))
{
UnityEngine.Debug.LogWarning("OVRADBTool " + errorString);
}
else
{
UnityEngine.Debug.LogError("OVRADBTool " + errorString);
}
}
return exitCode;
}
public Process RunCommandAsync(string[] arguments, DataReceivedEventHandler outputDataRecievedHandler)
{
if (!isReady)
{
Debug.LogWarning("OVRADBTool not ready");
return null;
}
string args = string.Join(" ", arguments);
ProcessStartInfo startInfo = new ProcessStartInfo(adbPath, args);
startInfo.WorkingDirectory = androidSdkRoot;
startInfo.CreateNoWindow = true;
startInfo.UseShellExecute = false;
startInfo.WindowStyle = ProcessWindowStyle.Hidden;
startInfo.RedirectStandardOutput = true;
startInfo.RedirectStandardError = true;
Process process = Process.Start(startInfo);
if (outputDataRecievedHandler != null)
{
process.OutputDataReceived += new DataReceivedEventHandler(outputDataRecievedHandler);
}
process.BeginOutputReadLine();
process.BeginErrorReadLine();
return process;
}
private void OutputDataReceivedHandler(object sendingProcess, DataReceivedEventArgs args)
{
// Collect the sort command output.
if (!string.IsNullOrEmpty(args.Data))
{
// Add the text to the collected output.
outputStringBuilder.Append(args.Data);
outputStringBuilder.Append(Environment.NewLine);
}
}
private void ErrorDataReceivedHandler(object sendingProcess, DataReceivedEventArgs args)
{
// Collect the sort command output.
if (!string.IsNullOrEmpty(args.Data))
{
// Add the text to the collected output.
errorStringBuilder.Append(args.Data);
errorStringBuilder.Append(Environment.NewLine);
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 41c2cab7d83278a4f8f44a44b694770f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,880 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* Licensed under the Oculus SDK License Agreement (the "License");
* you may not use the Oculus SDK except in compliance with the License,
* which is provided at the time of installation or download, or which
* otherwise accompanies this software in either electronic or hard copy form.
*
* You may obtain a copy of the License at
*
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Oculus SDK
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if USING_XR_MANAGEMENT && (USING_XR_SDK_OCULUS || USING_XR_SDK_OPENXR)
#define USING_XR_SDK
#endif
#if UNITY_2020_1_OR_NEWER
#define REQUIRES_XR_SDK
#endif
// Unit made a change that broke `BuildOptions.AcceptExternalModificationsToPlayer`
// Thread detailing issue: https://forum.unity.com/threads/oculus-build-invalidoperationexception-the-build-target-does-not-support-build-appending.994930/
#if UNITY_2020_1_OR_NEWER || UNITY_2019_4_OR_NEWER
#define DONT_USE_BUILD_OPTIONS_EXTERNAL_MODIFICATIONS_FLAG
#endif
using UnityEngine;
using UnityEditor;
using System;
using System.IO;
using System.Diagnostics;
using System.Collections.Generic;
using System.Threading;
/// <summary>
/// Allows Oculus to build apps from the command line.
/// </summary>
[InitializeOnLoadAttribute]
partial class OculusBuildApp : EditorWindow
{
static void SetPCTarget()
{
if (EditorUserBuildSettings.activeBuildTarget != BuildTarget.StandaloneWindows)
{
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Standalone, BuildTarget.StandaloneWindows);
}
#if !USING_XR_SDK && !REQUIRES_XR_SDK
UnityEditorInternal.VR.VREditor.SetVREnabledOnTargetGroup(BuildTargetGroup.Standalone, true);
#pragma warning disable 618
PlayerSettings.virtualRealitySupported = true;
#pragma warning restore 618
#endif
AssetDatabase.SaveAssets();
}
static void SetAndroidTarget()
{
EditorUserBuildSettings.androidBuildSubtarget = MobileTextureSubtarget.ASTC;
EditorUserBuildSettings.androidBuildSystem = AndroidBuildSystem.Gradle;
if (EditorUserBuildSettings.activeBuildTarget != BuildTarget.Android)
{
EditorUserBuildSettings.SwitchActiveBuildTarget(BuildTargetGroup.Android, BuildTarget.Android);
}
#if !USING_XR_SDK && !REQUIRES_XR_SDK
UnityEditorInternal.VR.VREditor.SetVREnabledOnTargetGroup(BuildTargetGroup.Standalone, true);
#pragma warning disable 618
PlayerSettings.virtualRealitySupported = true;
#pragma warning restore 618
#endif
AssetDatabase.SaveAssets();
}
#if UNITY_EDITOR_WIN && UNITY_ANDROID
// Build setting constants
const string REMOTE_APK_PATH = "/data/local/tmp";
const float USB_TRANSFER_SPEED_THRES = 25.0f;
const float USB_3_TRANSFER_SPEED = 32.0f;
const float TRANSFER_SPEED_CHECK_THRESHOLD = 4.0f;
const int NUM_BUILD_AND_RUN_STEPS = 9;
const int BYTES_TO_MEGABYTES = 1048576;
// Build window variables (not saved)
GUIStyle windowStyle;
GUIStyle calloutStyle;
string currConnectedDevice;
Vector2 scrollViewPos;
// Build window variables (saved)
static bool saveKeystorePasswords;
static bool isRunOnDevice;
static string outputApkPath;
// Progress bar variables
static int totalBuildSteps;
static int currentStep;
static string progressMessage;
// Build setting varaibles
static string gradlePath;
static string jdkPath;
static string androidSdkPath;
static string applicationIdentifier;
static bool isDevelopmentBuild;
static string productName;
static string dataPath;
static string gradleTempExport;
static string gradleExport;
static bool showCancel;
static bool buildInProgress;
static DirectorySyncer.CancellationTokenSource syncCancelToken;
static Process gradleBuildProcess;
static Thread buildThread;
static bool? apkOutputSuccessful;
[MenuItem("Oculus/OVR Build/OVR Build APK... %#k", false, 20)]
static void Init()
{
EditorWindow.GetWindow<OculusBuildApp>(false, "OVR Build APK", true);
OnBuildComplete();
}
[MenuItem("Oculus/OVR Build/OVR Build APK And Run %k", false, 21)]
static void InitAndRun()
{
var window = EditorWindow.GetWindow<OculusBuildApp>(false, "OVR Build APK", true);
isRunOnDevice = true; // make sure the "And Run" part of the menu name is true
window.StartBuild();
}
private void OnEnable()
{
isRunOnDevice = EditorPrefs.GetBool("OVRBuild_RunOnDevice", false);
saveKeystorePasswords = EditorPrefs.GetBool("OVRBuild_SaveKeystorePasswords", false);
if (saveKeystorePasswords)
{
if (EditorPrefs.HasKey("OVRBuild_KeystorePassword"))
PlayerSettings.Android.keystorePass = EditorPrefs.GetString("OVRBuild_KeystorePassword");
if (EditorPrefs.HasKey("OVRBuild_KeyAliasPassword"))
PlayerSettings.Android.keyaliasPass = EditorPrefs.GetString("OVRBuild_KeyAliasPassword");
}
outputApkPath = EditorPrefs.GetString("OVRBuild_BuiltAPKPath", "");
CheckADBDevices(out currConnectedDevice);
}
private void OnDisable()
{
EditorPrefs.SetBool("OVRBuild_RunOnDevice", isRunOnDevice);
EditorPrefs.SetBool("OVRBuild_SaveKeystorePasswords", saveKeystorePasswords);
if (saveKeystorePasswords)
{
EditorPrefs.SetString("OVRBuild_KeystorePassword", PlayerSettings.Android.keystorePass);
EditorPrefs.SetString("OVRBuild_KeyAliasPassword", PlayerSettings.Android.keyaliasPass);
}
else
{
EditorPrefs.DeleteKey("OVRBuild_KeystorePassword");
EditorPrefs.DeleteKey("OVRBuild_KeyAliasPassword");
}
EditorPrefs.SetString("OVRBuild_BuiltAPKPath", outputApkPath);
}
private void OnGUI()
{
if (windowStyle == null)
{
windowStyle = new GUIStyle();
windowStyle.margin = new RectOffset(10, 10, 10, 10);
}
if (calloutStyle == null)
{
calloutStyle = new GUIStyle(EditorStyles.label);
calloutStyle.richText = true;
calloutStyle.wordWrap = true;
}
// Fix progress bar window size
minSize = new Vector2(500, 305);
float oldLabelWidth = EditorGUIUtility.labelWidth;
EditorGUIUtility.labelWidth = 160;
EditorGUILayout.BeginVertical(windowStyle);
GUILayout.BeginHorizontal(EditorStyles.helpBox);
GUILayout.BeginVertical();
EditorGUILayout.LabelField("Builds created in the <b>OVR Build APK</b> window are identical to Unity-built APKs, but use the Gradle cache to only touch changed files, resulting in shorter build times.",
calloutStyle);
#if UNITY_2021_1_OR_NEWER
if (EditorGUILayout.LinkButton("Documentation"))
#else
if (GUILayout.Button("Documentation", GUILayout.ExpandWidth(false)))
#endif
{
Application.OpenURL("https://developer.oculus.com/documentation/unity/unity-build-android-tools/");
}
GUILayout.EndVertical();
GUILayout.EndHorizontal();
EditorGUILayout.Space(15f);
scrollViewPos = EditorGUILayout.BeginScrollView(scrollViewPos, GUIStyle.none, GUI.skin.verticalScrollbar);
using (new EditorGUI.DisabledScope(buildInProgress))
{
EditorGUILayout.BeginHorizontal();
outputApkPath = EditorGUILayout.TextField("Built APK Path", outputApkPath);
if (GUILayout.Button("Browse...", GUILayout.Width(80)))
DisplayAPKPathDialog();
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
PlayerSettings.Android.bundleVersionCode = EditorGUILayout.IntField(new GUIContent("Version Number",
"Builds uploaded to the Oculus storefront are required to have incrementing version numbers.\nThis value is exposed to players."),
PlayerSettings.Android.bundleVersionCode, GUILayout.Width(220));
EditorGUI.BeginChangeCheck();
bool isAutoIncrement = PlayerPrefs.GetInt(OVRGradleGeneration.prefName, 0) != 0;
isAutoIncrement = EditorGUILayout.ToggleLeft(new GUIContent("Auto-Increment?",
"If true, version number will be automatically incremented after every successful build."),
isAutoIncrement, EditorStyles.miniLabel, GUILayout.Width(120));
if (EditorGUI.EndChangeCheck())
OVRGradleGeneration.ToggleUtilities();
EditorGUILayout.EndHorizontal();
EditorGUILayout.Space(15f);
EditorGUILayout.BeginHorizontal();
using (new EditorGUI.DisabledScope(string.IsNullOrEmpty(currConnectedDevice)))
{
isRunOnDevice = EditorGUILayout.Toggle("Install & Run on Device?", isRunOnDevice);
GUILayout.FlexibleSpace();
EditorGUILayout.LabelField(string.IsNullOrEmpty(currConnectedDevice) ? "No device connected" : $"Device: {currConnectedDevice}");
}
if (GUILayout.Button("Refresh", GUILayout.Width(80)))
CheckADBDevices(out currConnectedDevice);
EditorGUILayout.EndHorizontal();
EditorUserBuildSettings.development = EditorGUILayout.Toggle(new GUIContent("Development Build?",
"Development builds allow you to debug scripts. However, they're slightly slower, and they're not allowed on the Oculus storefront."),
EditorUserBuildSettings.development);
EditorGUILayout.Space(15f);
EditorGUILayout.BeginHorizontal();
saveKeystorePasswords = EditorGUILayout.Toggle(new GUIContent("Save Keystore Passwords?",
"These values are also found in Project Settings > Player > [Android] > Publishing Settings > Project Keystore.\nStoring passwords is convenient, but reduces security."),
saveKeystorePasswords);
if (GUILayout.Button("Select Keystore...", GUILayout.Width(150)))
SettingsService.OpenProjectSettings("Project/Player");
EditorGUILayout.EndHorizontal();
if (saveKeystorePasswords)
{
EditorGUI.indentLevel++;
EditorGUILayout.LabelField("Keystore Path", PlayerSettings.Android.keystoreName);
PlayerSettings.Android.keystorePass = EditorGUILayout.PasswordField("Keystore Password", PlayerSettings.Android.keystorePass);
EditorGUILayout.LabelField("Key Alias Name", PlayerSettings.Android.keyaliasName);
PlayerSettings.Android.keyaliasPass = EditorGUILayout.PasswordField("Alias Password", PlayerSettings.Android.keyaliasPass);
EditorGUI.indentLevel--;
}
}
EditorGUILayout.EndScrollView();
EditorGUILayout.Space(10);
EditorGUILayout.BeginHorizontal();
GUILayout.FlexibleSpace();
//better to perform these at end of GUI
bool shouldCancel = false;
bool shouldBuild = false;
if (showCancel)
shouldCancel = GUILayout.Button("Cancel", GUILayout.Height(30), GUILayout.Width(100));
else
{
using (new EditorGUI.DisabledScope(buildInProgress))
{
shouldBuild = GUILayout.Button("Build", GUILayout.Height(30), GUILayout.Width(100));
}
}
GUILayout.FlexibleSpace();
EditorGUILayout.EndHorizontal();
EditorGUILayout.Space(10);
// Show progress bar
Rect progressRect = EditorGUILayout.GetControlRect(GUILayout.Height(25));
float progress = currentStep / (float)totalBuildSteps;
EditorGUI.ProgressBar(progressRect, progress, progressMessage);
EditorGUIUtility.labelWidth = oldLabelWidth;
EditorGUILayout.EndVertical();
if (shouldBuild)
StartBuild();
else if (shouldCancel)
CancelBuild();
}
void Update()
{
// Force window update if not in focus to ensure progress bar still updates
var window = EditorWindow.focusedWindow;
if (window != null && window.ToString().Contains("OculusBuildApp"))
{
Repaint();
}
}
void DisplayAPKPathDialog()
{
string fileName = "build.apk";
string path = "";
if (!string.IsNullOrEmpty(outputApkPath))
{
try
{
path = Path.GetDirectoryName(outputApkPath);
fileName = Path.GetFileName(outputApkPath);
}
catch (Exception)
{
//do nothing, we just have a malformed apkPath and should accept defaults
}
}
outputApkPath = EditorUtility.SaveFilePanel("APK Path", path, fileName, "apk");
Repaint();
}
void CancelBuild()
{
SetProgressBarMessage("Canceling . . .");
if (syncCancelToken != null)
{
syncCancelToken.Cancel();
}
if (apkOutputSuccessful.HasValue && apkOutputSuccessful.Value)
{
buildThread.Abort();
OnBuildComplete();
}
if (gradleBuildProcess != null && !gradleBuildProcess.HasExited)
{
var cancelThread = new Thread(delegate ()
{
CancelGradleBuild();
});
cancelThread.Start();
}
}
void CancelGradleBuild()
{
Process cancelGradleProcess = new Process();
string arguments = "-Xmx1024m -classpath \"" + gradlePath +
"\" org.gradle.launcher.GradleMain --stop";
var processInfo = new System.Diagnostics.ProcessStartInfo
{
WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal,
FileName = jdkPath,
Arguments = arguments,
RedirectStandardInput = true,
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardError = true,
RedirectStandardOutput = true,
};
cancelGradleProcess.StartInfo = processInfo;
cancelGradleProcess.EnableRaisingEvents = true;
cancelGradleProcess.OutputDataReceived += new DataReceivedEventHandler(
(s, e) =>
{
if (e != null && e.Data != null && e.Data.Length != 0)
{
UnityEngine.Debug.LogFormat("Gradle: {0}", e.Data);
}
}
);
apkOutputSuccessful = false;
cancelGradleProcess.Start();
cancelGradleProcess.BeginOutputReadLine();
cancelGradleProcess.WaitForExit();
OnBuildComplete();
}
public void StartBuild()
{
showCancel = false;
buildInProgress = true;
InitializeProgressBar(NUM_BUILD_AND_RUN_STEPS);
IncrementProgressBar("Exporting Unity Project . . .");
apkOutputSuccessful = null;
syncCancelToken = null;
gradleBuildProcess = null;
UnityEngine.Debug.Log("OVRBuild: Starting Unity build ...");
SetupDirectories();
// 1. Get scenes to build in Unity, and export gradle project
var buildResult = UnityBuildPlayer();
if (buildResult.summary.result == UnityEditor.Build.Reporting.BuildResult.Succeeded)
{
// Set static variables so build thread has updated data
showCancel = true;
gradlePath = OVRConfig.Instance.GetGradlePath();
jdkPath = OVRConfig.Instance.GetJDKPath();
androidSdkPath = OVRConfig.Instance.GetAndroidSDKPath();
applicationIdentifier = PlayerSettings.GetApplicationIdentifier(BuildTargetGroup.Android);
isDevelopmentBuild = EditorUserBuildSettings.development;
#if UNITY_2019_3_OR_NEWER
productName = "launcher";
#else
productName = Application.productName;
#endif
dataPath = Application.dataPath;
buildThread = new Thread(delegate ()
{
OVRBuildRun();
});
buildThread.Start();
return;
}
else if (buildResult.summary.result == UnityEditor.Build.Reporting.BuildResult.Cancelled)
{
UnityEngine.Debug.Log("Build cancelled.");
}
else
{
UnityEngine.Debug.Log("Build failed.");
}
OnBuildComplete();
}
private UnityEditor.Build.Reporting.BuildReport UnityBuildPlayer()
{
// Unity introduced a possible bug with Unity 2020.1.10f1 that causes an exception
// when building with the option 'BuildOptions.AcceptExternalModificationsToPlayer'
// In order to maintain the same logic, we are using `EditorUserBuildSettings.exportAsGoogleAndroidProject`
#if DONT_USE_BUILD_OPTIONS_EXTERNAL_MODIFICATIONS_FLAG
bool previousExportAsGoogleAndroidProject = EditorUserBuildSettings.exportAsGoogleAndroidProject;
EditorUserBuildSettings.exportAsGoogleAndroidProject = true;
#endif
try
{
var sceneList = GetScenesToBuild();
var buildOptions = BuildOptions.None;
if (isDevelopmentBuild)
buildOptions |= (BuildOptions.Development | BuildOptions.AllowDebugging);
if (isRunOnDevice)
buildOptions |= BuildOptions.AutoRunPlayer;
#if !DONT_USE_BUILD_OPTIONS_EXTERNAL_MODIFICATIONS_FLAG
buildOptions |= BuildOptions.AcceptExternalModificationsToPlayer;
#endif
var buildPlayerOptions = new BuildPlayerOptions
{
scenes = sceneList.ToArray(),
locationPathName = gradleTempExport,
target = BuildTarget.Android,
options = buildOptions
};
var buildResult = BuildPipeline.BuildPlayer(buildPlayerOptions);
UnityEngine.Debug.Log(UnityBuildPlayerSummary(buildResult));
return buildResult;
}
finally
{
#if DONT_USE_BUILD_OPTIONS_EXTERNAL_MODIFICATIONS_FLAG
EditorUserBuildSettings.exportAsGoogleAndroidProject = previousExportAsGoogleAndroidProject;
#endif
}
}
private static string UnityBuildPlayerSummary(UnityEditor.Build.Reporting.BuildReport report)
{
var sb = new System.Text.StringBuilder();
sb.Append($"Unity Build Player: Build {report.summary.result} ({report.summary.totalSize} bytes) in {report.summary.totalTime.TotalSeconds:0.00}s");
foreach (var step in report.steps)
{
sb.AppendLine();
if (step.depth > 0)
{
sb.Append(new String('-', step.depth));
sb.Append(' ');
}
sb.Append($"{step.name}: {step.duration:g}");
}
return sb.ToString();
}
private static void OVRBuildRun()
{
// 2. Process gradle project
IncrementProgressBar("Processing gradle project . . .");
if (ProcessGradleProject())
{
// 3. Build gradle project
IncrementProgressBar("Starting gradle build . . .");
if (BuildGradleProject())
{
CopyAPK();
// 4. Deploy and run
if (isRunOnDevice)
DeployAPK();
}
}
OnBuildComplete();
}
private static bool BuildGradleProject()
{
gradleBuildProcess = new Process();
string arguments = "-Xmx4096m -classpath \"" + gradlePath + "\" org.gradle.launcher.GradleMain --profile ";
if (isDevelopmentBuild)
arguments += "assembleDebug -x validateSigningDebug";
else
arguments += "assembleRelease -x verifyReleaseResources";
#if UNITY_2019_3_OR_NEWER
var gradleProjectPath = gradleExport;
#else
var gradleProjectPath = Path.Combine(gradleExport, productName);
#endif
var processInfo = new System.Diagnostics.ProcessStartInfo
{
WorkingDirectory = gradleProjectPath,
WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal,
FileName = jdkPath,
Arguments = arguments,
RedirectStandardInput = true,
UseShellExecute = false,
CreateNoWindow = true,
RedirectStandardError = true,
RedirectStandardOutput = true,
};
gradleBuildProcess.StartInfo = processInfo;
gradleBuildProcess.EnableRaisingEvents = true;
DateTime gradleStartTime = System.DateTime.Now;
DateTime gradleEndTime = System.DateTime.MinValue;
gradleBuildProcess.Exited += new System.EventHandler(
(s, e) =>
{
UnityEngine.Debug.Log("Gradle: Exited");
}
);
gradleBuildProcess.OutputDataReceived += new DataReceivedEventHandler(
(s, e) =>
{
if (e != null && e.Data != null &&
e.Data.Length != 0 &&
(e.Data.Contains("BUILD") || e.Data.StartsWith("See the profiling report at:")))
{
UnityEngine.Debug.LogFormat("Gradle: {0}", e.Data);
if (e.Data.Contains("SUCCESSFUL"))
{
string buildFlavor = isDevelopmentBuild ? "debug" : "release";
UnityEngine.Debug.LogFormat("APK Build Completed: {0}",
Path.Combine(gradleExport, $"build\\outputs\\apk\\{buildFlavor}", productName + $"-{buildFlavor}.apk").Replace("/", "\\"));
if (!apkOutputSuccessful.HasValue)
{
apkOutputSuccessful = true;
}
gradleEndTime = System.DateTime.Now;
}
else if (e.Data.Contains("FAILED"))
{
apkOutputSuccessful = false;
}
}
}
);
gradleBuildProcess.ErrorDataReceived += new DataReceivedEventHandler(
(s, e) =>
{
if (e != null && e.Data != null &&
e.Data.Length != 0)
{
UnityEngine.Debug.LogErrorFormat("Gradle: {0}", e.Data);
}
apkOutputSuccessful = false;
}
);
gradleBuildProcess.Start();
gradleBuildProcess.BeginOutputReadLine();
IncrementProgressBar("Building gradle project . . .");
gradleBuildProcess.WaitForExit();
// Add a timeout for if gradle unexpectedlly exits or errors out
Stopwatch timeout = new Stopwatch();
timeout.Start();
while (apkOutputSuccessful == null)
{
if (timeout.ElapsedMilliseconds > 5000)
{
UnityEngine.Debug.LogError("Gradle has exited unexpectedly.");
apkOutputSuccessful = false;
}
System.Threading.Thread.Sleep(100);
}
return apkOutputSuccessful.HasValue && apkOutputSuccessful.Value;
}
private static bool ProcessGradleProject()
{
DateTime syncStartTime = System.DateTime.Now;
DateTime syncEndTime = System.DateTime.MinValue;
try
{
var ps = System.Text.RegularExpressions.Regex.Escape("" + Path.DirectorySeparatorChar);
// ignore files .gradle/** build/** foo/.gradle/** and bar/build/**
var ignorePattern = string.Format("^([^{0}]+{0})?(\\.gradle|build){0}", ps);
var syncer = new DirectorySyncer(gradleTempExport,
gradleExport, ignorePattern);
syncCancelToken = new DirectorySyncer.CancellationTokenSource();
var syncResult = syncer.Synchronize(syncCancelToken.Token);
syncEndTime = System.DateTime.Now;
}
catch (Exception e)
{
UnityEngine.Debug.Log("OVRBuild: Processing gradle project failed with exception: " +
e.Message);
return false;
}
if (syncCancelToken.IsCancellationRequested)
{
return false;
}
return true;
}
private static List<string> GetScenesToBuild()
{
var sceneList = new List<string>();
foreach (var scene in EditorBuildSettings.scenes)
{
// Enumerate scenes in project and check if scene is enabled to build
if (scene.enabled)
{
sceneList.Add(scene.path);
}
}
return sceneList;
}
public static bool CopyAPK()
{
string buildFlavor = isDevelopmentBuild ? "debug" : "release";
string apkPathLocal = Path.Combine(gradleExport, productName, $"build\\outputs\\apk\\{buildFlavor}", productName + $"-{buildFlavor}.apk");
if (File.Exists(apkPathLocal))
{
try
{
File.Copy(apkPathLocal, outputApkPath, true);
UnityEngine.Debug.Log($"OVRBuild: Output APK generated at {outputApkPath}");
Process.Start("explorer.exe", Path.GetDirectoryName(outputApkPath));
return true;
}
catch (Exception)
{
return false;
}
}
return false;
}
public static bool DeployAPK()
{
// Create new instance of ADB Tool
var adbTool = new OVRADBTool(androidSdkPath);
if (adbTool.isReady)
{
string apkPathLocal;
string buildFlavor = isDevelopmentBuild ? "debug" : "release";
string gradleExportFolder = Path.Combine(gradleExport, productName, $"build\\outputs\\apk\\{buildFlavor}");
// Check to see if gradle output directory exists
gradleExportFolder = gradleExportFolder.Replace("/", "\\");
if (!Directory.Exists(gradleExportFolder))
{
UnityEngine.Debug.LogError("Could not find the gradle project at the expected path: " + gradleExportFolder);
return false;
}
// Search for output APK in gradle output directory
apkPathLocal = Path.Combine(gradleExportFolder, productName + $"-{buildFlavor}.apk");
if (!System.IO.File.Exists(apkPathLocal))
{
UnityEngine.Debug.LogError(string.Format("Could not find {0} in the gradle project.", productName + $"-{buildFlavor}.apk"));
return false;
}
string output, error;
DateTime timerStart;
// Ensure that the Oculus temp directory is on the device by making it
IncrementProgressBar("Making Temp directory on device");
string[] mkdirCommand = { "-d shell", "mkdir -p", REMOTE_APK_PATH };
if (adbTool.RunCommand(mkdirCommand, null, out output, out error) != 0) return false;
// Push APK to device, also time how long it takes
timerStart = System.DateTime.Now;
IncrementProgressBar("Pushing APK to device . . .");
string[] pushCommand = { "-d push", "\"" + apkPathLocal + "\"", REMOTE_APK_PATH };
if (adbTool.RunCommand(pushCommand, null, out output, out error) != 0) return false;
// Calculate the transfer speed and determine if user is using USB 2.0 or 3.0
// Only bother informing the user on non-trivial transfers, as for very short
// periods of time, things like process creation overhead can dwarf the actual
// transfer time.
TimeSpan pushTime = System.DateTime.Now - timerStart;
bool trivialPush = pushTime.TotalSeconds < TRANSFER_SPEED_CHECK_THRESHOLD;
long? apkSize = (trivialPush ? (long?)null : new System.IO.FileInfo(apkPathLocal).Length);
double? transferSpeed = (apkSize / pushTime.TotalSeconds) / BYTES_TO_MEGABYTES;
bool informLog = transferSpeed.HasValue && transferSpeed.Value < USB_TRANSFER_SPEED_THRES;
UnityEngine.Debug.Log("OVRADBTool: Push Success");
// Install the APK package on the device
IncrementProgressBar("Installing APK . . .");
string apkPath = REMOTE_APK_PATH + "/" + productName + "-debug.apk";
apkPath = apkPath.Replace(" ", "\\ ");
string[] installCommand = { "-d shell", "pm install -r", apkPath };
timerStart = System.DateTime.Now;
if (adbTool.RunCommand(installCommand, null, out output, out error) != 0) return false;
TimeSpan installTime = System.DateTime.Now - timerStart;
UnityEngine.Debug.Log("OVRADBTool: Install Success");
// Start the application on the device
IncrementProgressBar("Launching application on device . . .");
#if UNITY_2019_3_OR_NEWER
string playerActivityName = "\"" + applicationIdentifier + "/com.unity3d.player.UnityPlayerActivity\"";
#else
string playerActivityName = "\"" + applicationIdentifier + "/" + applicationIdentifier + ".UnityPlayerActivity\"";
#endif
string[] appStartCommand = { "-d shell", "am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -S -f 0x10200000 -n", playerActivityName };
if (adbTool.RunCommand(appStartCommand, null, out output, out error) != 0) return false;
UnityEngine.Debug.Log("OVRADBTool: Application Start Success");
IncrementProgressBar("Success!");
// If the user is using a USB 2.0 cable, inform them about improved transfer speeds and estimate time saved
if (informLog)
{
float usb3Time = apkSize.Value / (USB_3_TRANSFER_SPEED * BYTES_TO_MEGABYTES); // `informLog` can't be true if `apkSize` is null.
UnityEngine.Debug.Log(string.Format("OVRBuild has detected slow transfer speeds. A USB 3.0 cable is recommended to reduce the time it takes to deploy your project by approximatly {0:0.0} seconds", pushTime.TotalSeconds - usb3Time));
return true;
}
}
else
{
UnityEngine.Debug.LogError("Could not find the ADB executable in the specified Android SDK directory.");
}
return false;
}
private static void OnBuildComplete()
{
showCancel = false;
buildInProgress = false;
currentStep = 0;
SetProgressBarMessage("Waiting to build . . .", false);
}
private static bool CheckADBDevices(out string connectedDeviceName)
{
// Check if there are any ADB devices connected before starting the build process
var adbTool = new OVRADBTool(OVRConfig.Instance.GetAndroidSDKPath());
connectedDeviceName = null;
if (adbTool.isReady)
{
List<string> devices = adbTool.GetDevices();
if (devices.Count == 0)
{
UnityEngine.Debug.LogError("No ADB devices connected. Connect a device to this computer to run APK.");
return false;
}
else if (devices.Count > 1)
{
UnityEngine.Debug.LogError("Multiple ADB devices connected. Disconnect extra devices from this computer to run APK.");
return false;
}
else
{
connectedDeviceName = devices[0];
return true;
}
}
else
{
UnityEngine.Debug.LogError("OVR ADB Tool failed to initialize. Check the Android SDK path in [Edit -> Preferences -> External Tools]");
return false;
}
}
private static void SetupDirectories()
{
gradleTempExport = Path.Combine(Path.Combine(Application.dataPath, "../Temp"), "OVRGradleTempExport");
gradleExport = Path.Combine(Path.Combine(Application.dataPath, "../Temp"), "OVRGradleExport");
if (!Directory.Exists(gradleExport))
{
Directory.CreateDirectory(gradleExport);
}
}
private static void InitializeProgressBar(int stepCount)
{
currentStep = 0;
totalBuildSteps = stepCount;
}
private static void IncrementProgressBar(string message)
{
currentStep++;
progressMessage = message;
UnityEngine.Debug.Log("OVRBuild: " + message);
}
private static void SetProgressBarMessage(string message, bool log = true)
{
progressMessage = message;
if (log)
UnityEngine.Debug.Log("OVRBuild: " + message);
}
#endif //UNITY_EDITOR_WIN && UNITY_ANDROID
}

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: fef522d0247215a43be6b1a8819bd940
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -1,716 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* Licensed under the Oculus SDK License Agreement (the "License");
* you may not use the Oculus SDK except in compliance with the License,
* which is provided at the time of installation or download, or which
* otherwise accompanies this software in either electronic or hard copy form.
*
* You may obtain a copy of the License at
*
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Oculus SDK
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if UNITY_EDITOR_WIN && UNITY_ANDROID
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System;
using System.Linq;
using UnityEngine;
using UnityEditor;
using UnityEditor.Build.Reporting;
public class OVRBundleManager
{
public const string TRANSITION_APK_VERSION_NAME = "OVRTransitionAPKVersion";
public const string BUNDLE_MANAGER_OUTPUT_PATH = "OVRAssetBundles";
private const int BUNDLE_CHUNK_SIZE = 30;
private const string TRANSITION_SCENE_RELATIVE_PATH = "Scenes/OVRTransitionScene.unity";
private const string BUNDLE_MANAGER_MASTER_BUNDLE = "OVRMasterBundle";
private const string EXTERNAL_STORAGE_PATH = "/sdcard/Android/data";
private const string ADB_TOOL_INITIALIZE_ERROR = "Failed to initialize ADB Tool. Please check Android SDK path in Preferences -> External Tools";
private static string externalSceneCache;
private static string transitionScenePath;
private static string projectDefaultAppIdentifier;
private static string projectDefaultVersion;
private static AndroidArchitecture projectAndroidArchitecture;
private static ScriptingImplementation projectScriptImplementation;
private static ManagedStrippingLevel projectManagedStrippingLevel;
private static bool projectStripEngineCode;
public static void BuildDeployTransitionAPK()
{
OVRBundleTool.PrintLog("Building and deploying transition APK . . .\n", true);
PrebuildProjectSettingUpdate();
var buildPlayerOptions = CalculateBundleBuildPlayerOptions();
if (!buildPlayerOptions.HasValue)
{
return;
}
DateTime apkBuildStart = DateTime.Now;
BuildReport report = BuildPipeline.BuildPlayer(buildPlayerOptions.Value);
if (report.summary.result == BuildResult.Succeeded)
{
OVRBundleTool.PrintSuccess();
}
else if (report.summary.result == BuildResult.Failed)
{
OVRBundleTool.PrintError();
}
PostbuildProjectSettingUpdate();
}
public static void PrebuildProjectSettingUpdate()
{
// Save existing settings as some modifications can change other settings
projectDefaultAppIdentifier = PlayerSettings.GetApplicationIdentifier(BuildTargetGroup.Android);
projectDefaultVersion = PlayerSettings.bundleVersion;
projectAndroidArchitecture = PlayerSettings.Android.targetArchitectures;
projectScriptImplementation = PlayerSettings.GetScriptingBackend(EditorUserBuildSettings.selectedBuildTargetGroup);
projectManagedStrippingLevel = PlayerSettings.GetManagedStrippingLevel(BuildTargetGroup.Android);
projectStripEngineCode = PlayerSettings.stripEngineCode;
// Modify application identifier for transition APK
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android,
projectDefaultAppIdentifier + GetTransitionApkOptionalIdentifier());
// Set VersionCode as a unique identifier for transition APK
PlayerSettings.bundleVersion = TRANSITION_APK_VERSION_NAME;
// Modify Android target architecture as ARM64 does not support Mono.
if (projectAndroidArchitecture != AndroidArchitecture.ARMv7)
{
// Show message in console to make it more clear to developers
OVRBundleTool.PrintLog("Build will use ARMv7 as Android architecture.");
PlayerSettings.Android.targetArchitectures = AndroidArchitecture.ARMv7;
}
// Modify IL2CPP option as it strips script symbols that are necessary for the scenes at runtime
if (projectScriptImplementation != ScriptingImplementation.Mono2x)
{
// Show message in console to make it more clear to developers
OVRBundleTool.PrintLog("Build will use Mono as scripting backend.");
PlayerSettings.SetScriptingBackend(EditorUserBuildSettings.selectedBuildTargetGroup, ScriptingImplementation.Mono2x);
}
// Avoid stripping managed code that are necessary for the scenes at runtime
if (projectManagedStrippingLevel != ManagedStrippingLevel.Disabled)
{
OVRBundleTool.PrintLog("Build will set Managed Stripping Level to Disabled.");
PlayerSettings.SetManagedStrippingLevel(BuildTargetGroup.Android, ManagedStrippingLevel.Disabled);
}
if (projectStripEngineCode)
{
OVRBundleTool.PrintLog("Build will set Strip Engine Code to Disabled.");
PlayerSettings.stripEngineCode = false;
}
}
public static BuildPlayerOptions? CalculateBundleBuildPlayerOptions()
{
if (!Directory.Exists(BUNDLE_MANAGER_OUTPUT_PATH))
{
Directory.CreateDirectory(BUNDLE_MANAGER_OUTPUT_PATH);
}
if (String.IsNullOrEmpty(transitionScenePath))
{
// Get current editor script's directory as base path
string[] res = System.IO.Directory.GetFiles(Application.dataPath, "OVRBundleManager.cs", SearchOption.AllDirectories);
if (res.Length > 1)
{
OVRBundleTool.PrintError("More than one OVRBundleManager editor script has been found, please double check your Oculus SDK import.");
return null;
}
else
{
// Append Transition Scene's relative path to base path
var OVREditorScript = Path.GetDirectoryName(res[0]);
transitionScenePath = Path.Combine(OVREditorScript, TRANSITION_SCENE_RELATIVE_PATH);
}
}
string[] buildScenes = new string[1] { transitionScenePath };
string apkOutputPath = Path.Combine(BUNDLE_MANAGER_OUTPUT_PATH, "OVRTransition.apk");
return new BuildPlayerOptions
{
scenes = buildScenes,
locationPathName = apkOutputPath,
target = BuildTarget.Android,
options = BuildOptions.Development |
BuildOptions.AutoRunPlayer
};
}
public static void PostbuildProjectSettingUpdate()
{
// Restore application identifier
PlayerSettings.SetApplicationIdentifier(BuildTargetGroup.Android,
projectDefaultAppIdentifier);
// Restore version setting
PlayerSettings.bundleVersion = projectDefaultVersion;
// Restore scripting backend option
if (PlayerSettings.GetScriptingBackend(EditorUserBuildSettings.selectedBuildTargetGroup) != projectScriptImplementation)
{
PlayerSettings.SetScriptingBackend(EditorUserBuildSettings.selectedBuildTargetGroup, projectScriptImplementation);
}
// Restore managed stripping level
if (PlayerSettings.GetManagedStrippingLevel(BuildTargetGroup.Android) != projectManagedStrippingLevel)
{
PlayerSettings.SetManagedStrippingLevel(BuildTargetGroup.Android, projectManagedStrippingLevel);
}
// Restore Strip Engine Code
if (PlayerSettings.stripEngineCode != projectStripEngineCode)
{
PlayerSettings.stripEngineCode = projectStripEngineCode;
}
// Restore Android Architecture
if (PlayerSettings.Android.targetArchitectures != projectAndroidArchitecture)
{
PlayerSettings.Android.targetArchitectures = projectAndroidArchitecture;
}
}
// Build and deploy a list of scenes. It's suggested to only build and deploy one active scene that's being modified and
// its dependencies such as scenes that are loaded additively
public static void BuildDeployScenes(List<OVRBundleTool.EditorSceneInfo> sceneList, bool forceRestart)
{
externalSceneCache = EXTERNAL_STORAGE_PATH + "/" + PlayerSettings.GetApplicationIdentifier(BuildTargetGroup.Android)
+ GetTransitionApkOptionalIdentifier() + "/cache/scenes";
for (int i = 0; i < sceneList.Count; i++)
{
if (!sceneList[i].shouldDeploy) continue;
sceneList[i].buildStatus = OVRBundleTool.SceneBundleStatus.QUEUED;
}
BuildSceneBundles(sceneList);
if (DeploySceneBundles(sceneList))
{
if (forceRestart)
{
LaunchApplication();
return;
}
OVRBundleTool.PrintSuccess();
return;
}
}
// Build assets that are used by scenes from the given list.
// This function will automatically de-duplicated same asset file being referenced in multiple scenes.
// Scene bundles will be created with name pattern: <SceneName>_<AssetTypeExtention><ChunckNumber>
private static void BuildSceneBundles(List<OVRBundleTool.EditorSceneInfo> sceneList)
{
DateTime totalStart = DateTime.Now;
// Keeps track of dependent assets across scenes
// to ensure each asset is only packaged once in one of the scene bundles.
// uniqueAssetInSceneBundle is a map from "asset unique identifier" to the first scene that references the asset.
// It supports different assets with same file name as "asset unique identifier" contain full qualified asset file path
Dictionary<string, string> uniqueAssetInSceneBundle = new Dictionary<string, string>();
// List of bundle targets for Unity's build pipeline to package
List<AssetBundleBuild> assetBundleBuilds = new List<AssetBundleBuild>();
// Map that contains "asset type" to list of assets that are of the asset type
Dictionary<string, List<string>> extToAssetList = new Dictionary<string, List<string>>();
// Check if assets in Resources need to be packaged
if (CheckForResources())
{
var resourceDirectories = Directory.GetDirectories("Assets", "Resources", SearchOption.AllDirectories).ToArray();
// Fetch a list of all files in resource directory
string[] resourceAssetPaths = AssetDatabase.FindAssets("", resourceDirectories).Select(x => AssetDatabase.GUIDToAssetPath(x)).ToArray();
ProcessAssets(resourceAssetPaths, "resources", ref uniqueAssetInSceneBundle, ref extToAssetList);
AssetBundleBuild resourceBundle = new AssetBundleBuild();
resourceBundle.assetNames = uniqueAssetInSceneBundle.Keys.ToArray();
resourceBundle.assetBundleName = OVRSceneLoader.resourceBundleName;
assetBundleBuilds.Add(resourceBundle);
}
// Create scene bundle output directory
string sceneBundleDirectory = Path.Combine(BUNDLE_MANAGER_OUTPUT_PATH, BUNDLE_MANAGER_MASTER_BUNDLE);
if (!Directory.Exists(sceneBundleDirectory))
{
Directory.CreateDirectory(sceneBundleDirectory);
}
OVRBundleTool.PrintLog("Building scene bundles . . . ");
DateTime labelingStart = DateTime.Now;
for (int i = 0; i < sceneList.Count; ++i)
{
var scene = sceneList[i];
if (!scene.shouldDeploy) continue;
// Get all the assets that the scene depends on and sort them by type
DateTime getDepStart = DateTime.Now;
string[] assetDependencies = AssetDatabase.GetDependencies(scene.scenePath);
Debug.Log("[OVRBundleManager] - " + scene.sceneName + " - Calculated scene asset dependencies in: " + (DateTime.Now - getDepStart).TotalSeconds);
ProcessAssets(assetDependencies, scene.sceneName, ref uniqueAssetInSceneBundle, ref extToAssetList);
// Add the scene into it's own bundle
string[] sceneAsset = new string[1] { scene.scenePath };
AssetBundleBuild sceneBuild = new AssetBundleBuild();
sceneBuild.assetBundleName = "scene_" + scene.sceneName;
sceneBuild.assetNames = sceneAsset;
assetBundleBuilds.Add(sceneBuild);
}
// Chunk the asset bundles by number of assets
foreach (string ext in extToAssetList.Keys)
{
int assetCount = extToAssetList[ext].Count;
int numChunks = (assetCount + BUNDLE_CHUNK_SIZE - 1) / BUNDLE_CHUNK_SIZE;
//Debug.Log(ext + " has " + assetCount + " asset(s) that will be split into " + numChunks + " chunk(s)");
for (int i = 0; i < numChunks; i++)
{
List<string> assetChunkList;
if (i == numChunks - 1)
{
int size = BUNDLE_CHUNK_SIZE - (numChunks * BUNDLE_CHUNK_SIZE - assetCount);
assetChunkList = extToAssetList[ext].GetRange(i * BUNDLE_CHUNK_SIZE, size);
}
else
{
assetChunkList = extToAssetList[ext].GetRange(i * BUNDLE_CHUNK_SIZE, BUNDLE_CHUNK_SIZE);
}
AssetBundleBuild build = new AssetBundleBuild();
build.assetBundleName = "asset_" + ext + i;
build.assetNames = assetChunkList.ToArray();
//Debug.Log("Chunk " + i + " has " + assetChunkList.Count + " asset(s)");
assetBundleBuilds.Add(build);
}
}
Debug.Log("[OVRBundleManager] - Created chucked scene bundles in: " + (DateTime.Now - labelingStart).TotalSeconds);
// Build asset bundles
BuildPipeline.BuildAssetBundles(sceneBundleDirectory, assetBundleBuilds.ToArray(),
BuildAssetBundleOptions.UncompressedAssetBundle, BuildTarget.Android);
double bundleBuildTime = (DateTime.Now - totalStart).TotalSeconds;
Debug.Log("[OVRBundleManager] - Total Time: " + bundleBuildTime);
}
private static void ProcessAssets(string[] assetPaths,
string assetParent,
ref Dictionary<string, string> uniqueAssetInSceneBundle,
ref Dictionary<string, List<string>> extToAssetList)
{
foreach (string asset in assetPaths)
{
string ext = Path.GetExtension(asset);
if (!string.IsNullOrEmpty(ext))
{
ext = ext.Substring(1);
if (!ext.Equals("cs") && !ext.Equals("unity"))
{
// Only process each asset once across all resource and scene bundles
// Each asset is keyed by full path as a unique identifier
if (!uniqueAssetInSceneBundle.ContainsKey(asset))
{
var assetObject = (UnityEngine.Object)AssetDatabase.LoadAssetAtPath(asset, typeof(UnityEngine.Object));
if (assetObject == null || (assetObject.hideFlags & HideFlags.DontSaveInBuild) == 0)
{
uniqueAssetInSceneBundle[asset] = assetParent;
if (assetParent != "resources")
{
if (!extToAssetList.ContainsKey(ext))
{
extToAssetList[ext] = new List<string>();
}
extToAssetList[ext].Add(asset);
}
}
}
}
}
}
}
private static bool DeploySceneBundles(List<OVRBundleTool.EditorSceneInfo> sceneList)
{
// Create Temp directory on local machine if it does not exist
string tempDirectory = Path.Combine(BUNDLE_MANAGER_OUTPUT_PATH, "Temp");
if (!Directory.Exists(tempDirectory))
{
Directory.CreateDirectory(tempDirectory);
}
string absoluteTempPath = Path.Combine(Path.Combine(Application.dataPath, ".."), tempDirectory);
OVRBundleTool.PrintLog("Deploying scene bundles to device . . . ");
OVRADBTool adbTool = new OVRADBTool(OVRConfig.Instance.GetAndroidSDKPath());
if (adbTool.isReady)
{
DateTime transferStart = DateTime.Now;
for (int i = 0; i < sceneList.Count; ++i)
{
if (!sceneList[i].shouldDeploy) continue;
OVRBundleTool.UpdateSceneBuildStatus(OVRBundleTool.SceneBundleStatus.TRANSFERRING, i);
}
// Transfer all scene bundles that are relavent
if (!TransferSceneBundles(adbTool, absoluteTempPath, externalSceneCache))
{
return false;
}
for (int i = 0; i < sceneList.Count; ++i)
{
if (!sceneList[i].shouldDeploy) continue;
OVRBundleTool.UpdateSceneBuildStatus(OVRBundleTool.SceneBundleStatus.DEPLOYED, i);
}
// Create file to tell transition scene APK which scene to load and push it to the device
string sceneLoadDataPath = Path.Combine(tempDirectory, OVRSceneLoader.sceneLoadDataName);
if (File.Exists(sceneLoadDataPath))
{
File.Delete(sceneLoadDataPath);
}
StreamWriter writer = new StreamWriter(sceneLoadDataPath, true);
// Write version and scene names
long unixTime = (int)(DateTimeOffset.UtcNow.ToUniversalTime() - new DateTime(1970, 1, 1, 0, 0, 0)).TotalSeconds;
writer.WriteLine(unixTime.ToString());
for (int i = 0; i < sceneList.Count; i++)
{
if (!sceneList[i].shouldDeploy) continue;
writer.WriteLine(Path.GetFileNameWithoutExtension(sceneList[i].scenePath));
}
writer.Close();
string absoluteSceneLoadDataPath = Path.Combine(absoluteTempPath, OVRSceneLoader.sceneLoadDataName);
string[] pushCommand = { "-d push", "\"" + absoluteSceneLoadDataPath + "\"", "\"" + externalSceneCache + "\"" };
string output, error;
if (adbTool.RunCommand(pushCommand, null, out output, out error) == 0)
{
Debug.Log("[OVRBundleManager] Scene Load Data Pushed to Device.");
return true;
}
OVRBundleTool.PrintError(string.IsNullOrEmpty(error) ? output : error);
}
else
{
OVRBundleTool.PrintError(ADB_TOOL_INITIALIZE_ERROR);
}
return false;
}
private static bool TransferSceneBundles(OVRADBTool adbTool, string absoluteTempPath, string externalSceneCache)
{
List<string> bundlesToTransfer = new List<string>();
List<string> bundlesToDelete = new List<string>();
string manifestFilePath = externalSceneCache + "/" + BUNDLE_MANAGER_MASTER_BUNDLE;
string[] pullManifestCommand = { "-d pull", "\"" + manifestFilePath + "\"", "\"" + absoluteTempPath + "\"" };
string output, error;
if (adbTool.RunCommand(pullManifestCommand, null, out output, out error) == 0)
{
// An existing manifest file was found on device. Load hashes and upload bundles that have changed hashes.
Debug.Log("[OVRBundleManager] - Scene bundle manifest file found. Decoding changes . . .");
// Load hashes from remote manifest
AssetBundle remoteBundle = AssetBundle.LoadFromFile(Path.Combine(absoluteTempPath, BUNDLE_MANAGER_MASTER_BUNDLE));
if (remoteBundle == null)
{
OVRBundleTool.PrintError("Failed to load remote asset bundle manifest file.");
return false;
}
AssetBundleManifest remoteManifest = remoteBundle.LoadAsset<AssetBundleManifest>("AssetBundleManifest");
Dictionary<string, Hash128> remoteBundleToHash = new Dictionary<string, Hash128>();
if (remoteManifest != null)
{
string[] assetBundles = remoteManifest.GetAllAssetBundles();
foreach (string bundleName in assetBundles)
{
remoteBundleToHash[bundleName] = remoteManifest.GetAssetBundleHash(bundleName);
}
}
remoteBundle.Unload(true);
// Load hashes from local manifest
AssetBundle localBundle = AssetBundle.LoadFromFile(BUNDLE_MANAGER_OUTPUT_PATH + "\\" + BUNDLE_MANAGER_MASTER_BUNDLE
+ "\\" + BUNDLE_MANAGER_MASTER_BUNDLE);
if (localBundle == null)
{
OVRBundleTool.PrintError("<color=red>Failed to load local asset bundle manifest file.\n</color>");
return false;
}
AssetBundleManifest localManifest = localBundle.LoadAsset<AssetBundleManifest>("AssetBundleManifest");
if (localManifest != null)
{
Hash128 zeroHash = new Hash128(0, 0, 0, 0);
// Build a list of dirty bundles that will have to be transfered
string relativeSceneBundlesPath = Path.Combine(BUNDLE_MANAGER_OUTPUT_PATH, BUNDLE_MANAGER_MASTER_BUNDLE);
bundlesToTransfer.Add(Path.Combine(relativeSceneBundlesPath, BUNDLE_MANAGER_MASTER_BUNDLE));
string[] assetBundles = localManifest.GetAllAssetBundles();
foreach (string bundleName in assetBundles)
{
if (!remoteBundleToHash.ContainsKey(bundleName))
{
bundlesToTransfer.Add(Path.Combine(relativeSceneBundlesPath, bundleName));
}
else
{
if (remoteBundleToHash[bundleName] != localManifest.GetAssetBundleHash(bundleName))
{
bundlesToTransfer.Add(Path.Combine(relativeSceneBundlesPath, bundleName));
}
remoteBundleToHash[bundleName] = zeroHash;
}
}
OVRBundleTool.PrintLog(bundlesToTransfer.Count + " dirty bundle(s) will be transfered.\n");
}
}
else
{
if (output.Contains("does not exist") || output.Contains("No such file or directory"))
{
// Fresh install of asset bundles, transfer all asset bundles
OVRBundleTool.PrintLog("Manifest file not found. Transfering all bundles . . . ");
string[] mkdirCommand = { "-d shell", "mkdir -p", "\"" + externalSceneCache + "\"" };
if (adbTool.RunCommand(mkdirCommand, null, out output, out error) == 0)
{
string absoluteSceneBundlePath = Path.Combine(Path.Combine(Application.dataPath, ".."),
Path.Combine(BUNDLE_MANAGER_OUTPUT_PATH, BUNDLE_MANAGER_MASTER_BUNDLE));
string[] assetBundlePaths = Directory.GetFiles(absoluteSceneBundlePath);
if (assetBundlePaths.Length != 0)
{
foreach (string path in assetBundlePaths)
{
if (!path.Contains(".manifest"))
{
bundlesToTransfer.Add(path);
}
}
}
else
{
OVRBundleTool.PrintError("Failed to locate scene bundles to transfer.");
return false;
}
}
}
}
// If any adb error occured during manifest calculation, print it and return false
if (!string.IsNullOrEmpty(error) || output.Contains("error"))
{
OVRBundleTool.PrintError(string.IsNullOrEmpty(error) ? output : error);
return false;
}
// Transfer bundles to device
DateTime transferStart = DateTime.Now;
foreach (string bundle in bundlesToTransfer)
{
string absoluteBundlePath = Path.Combine(Path.Combine(Application.dataPath, ".."), bundle);
string[] pushBundleCommand = { "-d push", "\"" + absoluteBundlePath + "\"", "\"" + externalSceneCache + "\"" };
adbTool.RunCommandAsync(pushBundleCommand, null);
}
Debug.Log("[OVRBundleManager] - Transfer took " + (DateTime.Now - transferStart).TotalSeconds + " seconds.");
// Delete stale bundles on device
if (bundlesToDelete.Count > 0)
{
foreach (string bundle in bundlesToDelete)
{
string bundlePath = externalSceneCache + "/" + bundle;
string[] deleteBundleCommand = { "-d shell", "rm", "\"" + bundlePath + "\"" };
adbTool.RunCommandAsync(deleteBundleCommand, null);
}
OVRBundleTool.PrintLog("Deleted " + bundlesToDelete.Count + " bundle(s) that were stale");
}
return true;
}
public static bool LaunchApplication()
{
OVRBundleTool.PrintLog("Launching Application . . . ");
OVRADBTool adbTool = new OVRADBTool(OVRConfig.Instance.GetAndroidSDKPath());
if (adbTool.isReady)
{
string output, error;
string appPackagename = PlayerSettings.GetApplicationIdentifier(BuildTargetGroup.Android)
+ GetTransitionApkOptionalIdentifier();
string playerActivityName = "\"" + appPackagename + "/com.unity3d.player.UnityPlayerActivity\"";
string[] appStartCommand = { "-d shell", "am start -a android.intent.action.MAIN -c android.intent.category.LAUNCHER -S -f 0x10200000 -n", playerActivityName };
if (adbTool.RunCommand(appStartCommand, null, out output, out error) == 0)
{
OVRBundleTool.PrintSuccess();
OVRBundleTool.PrintLog("App package " + appPackagename + " is launched.");
return true;
}
string completeError = "Failed to launch application. Try launching it manually through the device.\n" + (string.IsNullOrEmpty(error) ? output : error);
OVRBundleTool.PrintError(completeError);
}
else
{
OVRBundleTool.PrintError(ADB_TOOL_INITIALIZE_ERROR);
}
return false;
}
public static bool UninstallAPK()
{
OVRBundleTool.PrintLog("Uninstalling Application . . .");
OVRADBTool adbTool = new OVRADBTool(OVRConfig.Instance.GetAndroidSDKPath());
if (adbTool.isReady)
{
string output, error;
string appPackagename = PlayerSettings.GetApplicationIdentifier(BuildTargetGroup.Android)
+ GetTransitionApkOptionalIdentifier();
string[] appStartCommand = { "-d shell", "pm uninstall", appPackagename };
if (adbTool.RunCommand(appStartCommand, null, out output, out error) == 0)
{
OVRBundleTool.PrintSuccess();
OVRBundleTool.PrintLog("App package " + appPackagename + " is uninstalled.");
return true;
}
OVRBundleTool.PrintError("Failed to uninstall APK.");
}
else
{
OVRBundleTool.PrintError(ADB_TOOL_INITIALIZE_ERROR);
}
return false;
}
public static void DeleteRemoteAssetBundles()
{
OVRADBTool adbTool = new OVRADBTool(OVRConfig.Instance.GetAndroidSDKPath());
if (adbTool.isReady)
{
externalSceneCache = EXTERNAL_STORAGE_PATH + "/" + PlayerSettings.GetApplicationIdentifier(BuildTargetGroup.Android)
+ GetTransitionApkOptionalIdentifier() + "/cache/scenes";
bool failure = false;
string fileExistsError = "No such file or directory";
OVRBundleTool.PrintLog("Deleting device bundles . . . ");
string output, error;
string[] deleteBundleCommand = { "-d shell", "rm -r", externalSceneCache };
if (adbTool.RunCommand(deleteBundleCommand, null, out output, out error) != 0)
{
if (!(output.Contains(fileExistsError) || error.Contains(fileExistsError)))
{
failure = true;
}
}
if (failure)
{
OVRBundleTool.PrintError(string.IsNullOrEmpty(error) ? output : error);
OVRBundleTool.PrintError("Failed to delete scene bundle cache directory.");
}
else
{
OVRBundleTool.PrintSuccess();
}
}
else
{
OVRBundleTool.PrintError(ADB_TOOL_INITIALIZE_ERROR);
}
}
public static string[] ListRemoteAssetBundleNames()
{
OVRADBTool adbTool = new OVRADBTool(OVRConfig.Instance.GetAndroidSDKPath());
if (adbTool.isReady)
{
externalSceneCache = EXTERNAL_STORAGE_PATH + "/" + PlayerSettings.GetApplicationIdentifier(BuildTargetGroup.Android)
+ GetTransitionApkOptionalIdentifier() + "/cache/scenes";
string output, error;
string[] listBundlesCommand = { "-d shell", "ls", externalSceneCache };
if (adbTool.RunCommand(listBundlesCommand, null, out output, out error) == 0)
{
return output.Split(new[]{ '\r', '\n'}, StringSplitOptions.RemoveEmptyEntries);
}
}
return null;
}
public static void DeleteLocalAssetBundles()
{
try
{
if (Directory.Exists(BUNDLE_MANAGER_OUTPUT_PATH))
{
OVRBundleTool.PrintLog("Deleting local bundles . . . ");
Directory.Delete(BUNDLE_MANAGER_OUTPUT_PATH, true);
}
}
catch (Exception e)
{
OVRBundleTool.PrintError(e.Message);
}
OVRBundleTool.PrintSuccess();
}
private static bool CheckForResources()
{
string[] resourceDirectories = Directory.GetDirectories("Assets", "Resources", SearchOption.AllDirectories);
return resourceDirectories.Length > 0;
}
private static string GetTransitionApkOptionalIdentifier()
{
string transitionApkOptionalIdentifier;
// Check option value from editor UI
if (OVRBundleTool.GetUseOptionalTransitionApkPackage())
{
// Append .transition to default app package name to optionally allow both
// full build apk and transition apk to be installed on device
transitionApkOptionalIdentifier = ".transition";
}
else
{
transitionApkOptionalIdentifier = "";
}
return transitionApkOptionalIdentifier;
}
}
#endif

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 7a46c155525da654c8ef823c069361d3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,647 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* Licensed under the Oculus SDK License Agreement (the "License");
* you may not use the Oculus SDK except in compliance with the License,
* which is provided at the time of installation or download, or which
* otherwise accompanies this software in either electronic or hard copy form.
*
* You may obtain a copy of the License at
*
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Oculus SDK
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if UNITY_EDITOR_WIN && UNITY_ANDROID
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Reflection;
using System.IO;
using UnityEngine;
using UnityEditor;
public class OVRBundleTool : EditorWindow
{
private static List<EditorSceneInfo> buildableScenes;
private static Vector2 debugLogScroll = new Vector2(0, 0);
private static bool invalidBuildableScene;
private static string toolLog;
private static bool deployScenesWhenDeployingApk;
private static bool useOptionalTransitionApkPackage;
private static GUIStyle windowStyle;
private static GUIStyle logBoxStyle;
private static GUIStyle statusStyle;
private static Vector2 logBoxSize;
private static Vector2 sceneScrollViewPos;
private bool forceRestart = false;
private bool showBundleManagement = false;
private bool showOther = false;
// Needed to ensure that APK checking does happen during editor start up, but will still happen when the window is opened/updated
private static bool panelInitialized = false;
const float spacesPerIndent = 12;
private enum ApkStatus
{
UNKNOWN,
OK,
NOT_INSTALLED,
DEVICE_NOT_CONNECTED,
};
public enum SceneBundleStatus
{
[Description("")]
UNKNOWN,
[Description("Queued")]
QUEUED,
[Description("Building")]
BUILDING,
[Description("Done")]
DONE,
[Description("Transferring")]
TRANSFERRING,
[Description("Deployed")]
DEPLOYED,
};
public class EditorSceneInfo
{
public string scenePath;
public string sceneName;
public SceneBundleStatus buildStatus;
public bool shouldDeploy;
public EditorSceneInfo(string path, string name)
{
scenePath = path;
sceneName = name;
buildStatus = SceneBundleStatus.UNKNOWN;
shouldDeploy = true;
}
}
private enum GuiAction
{
None,
OpenBuildSettingsWindow,
BuildAndDeployScenes,
BuildAndDeployApp,
ClearDeviceBundles,
ClearLocalBundles,
LaunchApp,
UninstallApk,
ClearLog,
}
private GuiAction action = GuiAction.None;
private static ApkStatus currentApkStatus;
private const string deployScenesWhenDeployingApkPrefName = "OVRBundleTool_DeployScenesWithAPK";
private const string useOptionalTransitionApkPackagePrefName = "OVRBundleTool_UseOptionalPackageName";
[MenuItem("Oculus/OVR Build/OVR Scene Quick Preview %l", false, 10)]
static void Init()
{
currentApkStatus = ApkStatus.UNKNOWN;
EditorWindow.GetWindow(typeof(OVRBundleTool));
invalidBuildableScene = false;
InitializePanel();
OVRPlugin.SetDeveloperMode(OVRPlugin.Bool.True);
OVRPlugin.SendEvent("oculus_bundle_tool", "show_window");
}
public void OnEnable()
{
InitializePanel();
}
public static void InitializePanel()
{
panelInitialized = true;
GetScenesFromBuildSettings();
deployScenesWhenDeployingApk = EditorPrefs.GetBool(deployScenesWhenDeployingApkPrefName, true);
useOptionalTransitionApkPackage = EditorPrefs.GetBool(useOptionalTransitionApkPackagePrefName, false);
EditorBuildSettings.sceneListChanged += GetScenesFromBuildSettings;
}
private void OnGUI()
{
this.titleContent.text = "OVR Scene Quick Preview";
if (panelInitialized)
{
CheckForTransitionAPK();
CheckForDeployedScenes();
panelInitialized = false;
}
if (windowStyle == null)
{
windowStyle = new GUIStyle();
windowStyle.margin = new RectOffset(10, 10, 10, 10);
}
if (logBoxStyle == null)
{
logBoxStyle = new GUIStyle();
logBoxStyle.margin.left = 5;
logBoxStyle.wordWrap = true;
logBoxStyle.normal.textColor = logBoxStyle.focused.textColor = EditorStyles.label.normal.textColor;
logBoxStyle.richText = true;
}
if (statusStyle == null)
{
statusStyle = new GUIStyle(EditorStyles.label);
statusStyle.richText = true;
}
EditorGUILayout.BeginVertical(windowStyle);
GUILayout.BeginHorizontal(EditorStyles.helpBox);
GUILayout.BeginVertical();
EditorGUILayout.LabelField("OVR Scene Quick Preview generates a version of your app which supports hot-reloading "
+ "content changes to individual scenes, reducing iteration time.",
EditorStyles.wordWrappedLabel);
#if UNITY_2021_1_OR_NEWER
if (EditorGUILayout.LinkButton("Documentation"))
#else
if (GUILayout.Button("Documentation", GUILayout.ExpandWidth(false)))
#endif
{
Application.OpenURL("https://developer.oculus.com/documentation/unity/unity-build-android-tools/");
}
GUILayout.EndVertical();
GUILayout.EndHorizontal();
GUILayout.Space(10f);
GUIContent transitionContent = new GUIContent("Modified APK [?]",
"Build and deploy an APK that can hot-reload scenes. This enables fast iteration on content changes to scenes.");
GUILayout.Label(transitionContent, EditorStyles.boldLabel);
EditorGUILayout.BeginHorizontal();
{
GUILayout.Label("Status: ", statusStyle, GUILayout.ExpandWidth(false));
string statusMesssage;
switch (currentApkStatus)
{
case ApkStatus.OK:
statusMesssage = "<color=green>APK installed. Ready to build and deploy scenes.</color>";
break;
case ApkStatus.NOT_INSTALLED:
statusMesssage = "<color=red>APK not installed. Press \"Build and Deploy APK\" to install the modified APK.</color>";
break;
case ApkStatus.DEVICE_NOT_CONNECTED:
statusMesssage = "<color=red>Device not connected via ADB. Please connect device and allow debugging.</color>";
break;
case ApkStatus.UNKNOWN:
default:
statusMesssage = "<color=red>Failed to get APK status!</color>";
break;
}
GUILayout.Label(statusMesssage, statusStyle, GUILayout.ExpandWidth(true));
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
if (GUILayout.Button("Build and Deploy APK", GUILayout.Width(200)))
{
action = GuiAction.BuildAndDeployApp;
}
EditorGUI.BeginDisabledGroup(currentApkStatus != ApkStatus.OK);
if (GUILayout.Button("Launch APK", GUILayout.Width(120)))
{
action = GuiAction.LaunchApp;
}
EditorGUI.EndDisabledGroup();
EditorGUILayout.EndHorizontal();
GUILayout.Space(10f);
GUIContent scenesContent = new GUIContent("Scenes [?]",
"Build and deploy individual scenes, which can be hot-reloaded at runtime by the modified APK.");
GUILayout.Label(scenesContent, EditorStyles.boldLabel);
GUIContent buildSettingsBtnTxt = new GUIContent("Open Build Settings");
GUIContent deployLabelTxt = new GUIContent("Deploy?",
"If true, this scene will be hot-reloaded. To reduce iteration time, only deploy scenes under active iteration.");
if (buildableScenes == null || buildableScenes.Count == 0)
{
string sceneErrorMessage;
if (invalidBuildableScene)
{
sceneErrorMessage = "Invalid scene selection. \nPlease remove OVRTransitionScene in the project's build settings.";
}
else
{
sceneErrorMessage = "No scenes detected. \nTo get started, add scenes in the project's build settings.";
}
GUILayout.Label(sceneErrorMessage);
var buildSettingBtnRt = GUILayoutUtility.GetRect(buildSettingsBtnTxt, GUI.skin.button, GUILayout.Width(150));
if (GUI.Button(buildSettingBtnRt, buildSettingsBtnTxt))
{
action = GuiAction.OpenBuildSettingsWindow;
}
}
else
{
float currWidth = EditorGUIUtility.currentViewWidth;
float sceneNameWidth = Math.Max(EditorGUIUtility.currentViewWidth - 170, 60);
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Scene Name", GUI.skin.box, GUILayout.Width(sceneNameWidth));
EditorGUILayout.LabelField("Status", GUI.skin.box, GUILayout.Width(80));
EditorGUILayout.LabelField(deployLabelTxt, GUI.skin.box, GUILayout.Width(60));
EditorGUILayout.EndHorizontal();
int scrollViewHeight = Math.Min(buildableScenes.Count * 21, 200);
sceneScrollViewPos = EditorGUILayout.BeginScrollView(sceneScrollViewPos, GUILayout.MaxHeight(scrollViewHeight));
foreach (EditorSceneInfo scene in buildableScenes)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(scene.sceneName, GUILayout.Width(sceneNameWidth + 8));
EditorGUILayout.LabelField(GetEnumDescription(scene.buildStatus), GUILayout.Width(80));
scene.shouldDeploy = EditorGUILayout.Toggle(scene.shouldDeploy, GUILayout.Width(30));
EditorGUILayout.EndHorizontal();
}
EditorGUILayout.EndScrollView();
EditorGUILayout.BeginHorizontal();
{
if (GUILayout.Button("Build and Deploy Scene(s)", GUILayout.Width(200)))
{
action = GuiAction.BuildAndDeployScenes;
}
GUILayout.Space(10);
GUIContent forceRestartLabel = new GUIContent("Force Restart [?]", "Relaunch the application after scene bundles are finished deploying.");
forceRestart = GUILayout.Toggle(forceRestart, forceRestartLabel, GUILayout.ExpandWidth(true));
}
EditorGUILayout.EndHorizontal();
}
GUILayout.Space(10.0f);
GUILayout.Label("Utilities", EditorStyles.boldLabel);
showBundleManagement = EditorGUILayout.BeginFoldoutHeaderGroup(showBundleManagement, "Bundle Management", EditorStyles.foldoutHeader);
if (showBundleManagement)
{
EditorGUILayout.BeginHorizontal();
{
EditorGUILayout.Space(EditorGUI.indentLevel * spacesPerIndent, false); //to match indentLevel
GUIContent clearDeviceBundlesTxt = new GUIContent("Delete Device Bundles [?]",
"Asset bundles to support hot-reloading are stored in an external location on-device. Click to delete them, freeing up space on-device.");
if (GUILayout.Button(clearDeviceBundlesTxt, GUILayout.ExpandWidth(true)))
{
action = GuiAction.ClearDeviceBundles;
}
GUIContent clearLocalBundlesTxt = new GUIContent("Delete Local Bundles [?]",
$"Locally, asset bundles are built into the \"{OVRBundleManager.BUNDLE_MANAGER_OUTPUT_PATH}\" folder at project root. "
+ "Click to delete them, freeing up local space.");
if (GUILayout.Button(clearLocalBundlesTxt, GUILayout.ExpandWidth(true)))
{
action = GuiAction.ClearLocalBundles;
}
}
EditorGUILayout.EndHorizontal();
}
EditorGUILayout.EndFoldoutHeaderGroup();
GUILayout.Space(5.0f);
showOther = EditorGUILayout.BeginFoldoutHeaderGroup(showOther, "Other", EditorStyles.foldoutHeader);
if (showOther)
{
const float otherLabelsWidth = 240f;
EditorGUI.indentLevel++;
EditorGUILayout.BeginHorizontal();
GUIContent deployScenesWithApkLabel = new GUIContent("Deploy scenes with APK deploy [?]",
"If checked, all scenes will be built & deployed when pressing \"Build and Deploy APK\". This takes longer, but provides more expected behavior.");
EditorGUILayout.LabelField(deployScenesWithApkLabel, GUILayout.Width(otherLabelsWidth));
bool newToggleValue = EditorGUILayout.Toggle(deployScenesWhenDeployingApk);
if (newToggleValue != deployScenesWhenDeployingApk)
{
deployScenesWhenDeployingApk = newToggleValue;
EditorPrefs.SetBool(deployScenesWhenDeployingApkPrefName, deployScenesWhenDeployingApk);
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
GUIContent useOptionalTransitionPackageLabel = new GUIContent("Use optional APK package name [?]",
"This allows both full build APK and transition APK to be installed on device. However, platform services like Entitlement check may fail.");
EditorGUILayout.LabelField(useOptionalTransitionPackageLabel, GUILayout.Width(otherLabelsWidth));
newToggleValue = EditorGUILayout.Toggle(useOptionalTransitionApkPackage);
if (newToggleValue != useOptionalTransitionApkPackage)
{
useOptionalTransitionApkPackage = newToggleValue;
EditorPrefs.SetBool(useOptionalTransitionApkPackagePrefName, useOptionalTransitionApkPackage);
// New package name = new check for associated data
CheckForTransitionAPK();
CheckForDeployedScenes();
}
EditorGUILayout.EndHorizontal();
EditorGUILayout.BeginHorizontal();
EditorGUILayout.Space(EditorGUI.indentLevel * spacesPerIndent, false); //to match indentLevel
if (GUILayout.Button(buildSettingsBtnTxt, GUILayout.ExpandWidth(true)))
{
action = GuiAction.OpenBuildSettingsWindow;
}
if (GUILayout.Button("Uninstall APK", GUILayout.ExpandWidth(true)))
{
action = GuiAction.UninstallApk;
}
EditorGUILayout.EndHorizontal();
EditorGUI.indentLevel--;
}
EditorGUILayout.EndFoldoutHeaderGroup();
GUILayout.Space(6f);
GUILayout.Label("", GUI.skin.horizontalSlider);
GUILayout.Space(10f);
EditorGUILayout.BeginHorizontal();
GUILayout.Label("Log", EditorStyles.boldLabel);
GUILayout.FlexibleSpace();
if (GUILayout.Button("Clear Log", EditorStyles.miniButton))
{
action = GuiAction.ClearLog;
}
EditorGUILayout.EndHorizontal();
debugLogScroll = EditorGUILayout.BeginScrollView(debugLogScroll, EditorStyles.helpBox, GUILayout.ExpandHeight(true));
if (!string.IsNullOrEmpty(toolLog))
{
EditorGUILayout.SelectableLabel(toolLog, logBoxStyle, GUILayout.Height(logBoxSize.y));
}
EditorGUILayout.EndScrollView();
EditorGUILayout.EndVertical();
}
private void Update()
{
switch (action)
{
case GuiAction.OpenBuildSettingsWindow:
OpenBuildSettingsWindow();
break;
case GuiAction.BuildAndDeployScenes:
OVRBundleManager.BuildDeployScenes(buildableScenes, forceRestart);
CheckForDeployedScenes();
break;
case GuiAction.BuildAndDeployApp:
OVRBundleManager.BuildDeployTransitionAPK();
CheckForTransitionAPK();
if (deployScenesWhenDeployingApk)
{
buildableScenes.ForEach(x => x.shouldDeploy = true);
OVRBundleManager.BuildDeployScenes(buildableScenes, false);
CheckForDeployedScenes();
}
OVRBundleManager.LaunchApplication();
break;
case GuiAction.ClearDeviceBundles:
OVRBundleManager.DeleteRemoteAssetBundles();
CheckForDeployedScenes();
break;
case GuiAction.ClearLocalBundles:
OVRBundleManager.DeleteLocalAssetBundles();
break;
case GuiAction.LaunchApp:
OVRBundleManager.LaunchApplication();
break;
case GuiAction.UninstallApk:
OVRBundleManager.UninstallAPK();
CheckForTransitionAPK();
CheckForDeployedScenes();
break;
case GuiAction.ClearLog:
PrintLog("", true);
break;
default:
break;
}
action = GuiAction.None;
}
private static void OpenBuildSettingsWindow()
{
EditorWindow.GetWindow(System.Type.GetType("UnityEditor.BuildPlayerWindow,UnityEditor"));
}
public static void UpdateSceneBuildStatus(SceneBundleStatus status, int index = -1)
{
if (buildableScenes == null)
{
return;
}
if (index >= 0 && index < buildableScenes.Count)
{
buildableScenes[index].buildStatus = status;
}
else
{
// Update status for all scenes
for (int i = 0; i < buildableScenes.Count; i++)
{
buildableScenes[i].buildStatus = status;
}
}
}
private static void GetScenesFromBuildSettings()
{
invalidBuildableScene = false;
buildableScenes = new List<EditorSceneInfo>();
for (int i = 0; i < EditorBuildSettings.scenes.Length; i++)
{
EditorBuildSettingsScene scene = EditorBuildSettings.scenes[i];
if (scene.enabled)
{
if (Path.GetFileNameWithoutExtension(scene.path) != "OVRTransitionScene")
{
EditorSceneInfo sceneInfo = new EditorSceneInfo(scene.path, Path.GetFileNameWithoutExtension(scene.path));
buildableScenes.Add(sceneInfo);
}
else
{
buildableScenes = null;
invalidBuildableScene = true;
return;
}
}
}
}
private static void CheckForTransitionAPK()
{
OVRADBTool adbTool = new OVRADBTool(OVRConfig.Instance.GetAndroidSDKPath());
if (adbTool.isReady)
{
string matchedPackageList, error;
var transitionPackageName = PlayerSettings.GetApplicationIdentifier(BuildTargetGroup.Android);
if (useOptionalTransitionApkPackage)
{
transitionPackageName += ".transition";
}
string[] packageCheckCommand = new string[] { "-d shell pm list package", transitionPackageName };
if (adbTool.RunCommand(packageCheckCommand, null, out matchedPackageList, out error) == 0)
{
if (string.IsNullOrEmpty(matchedPackageList))
{
currentApkStatus = ApkStatus.NOT_INSTALLED;
}
else
{
// adb "list package" command returns all package names that contains the given query package name
// Need to check if the transition package name is matched exactly
if (matchedPackageList.Contains("package:" + transitionPackageName + "\r\n"))
{
if (useOptionalTransitionApkPackage)
{
// If optional package name is used, it is deterministic that the transition apk is installed
currentApkStatus = ApkStatus.OK;
}
else
{
// get package info to check for TRANSITION_APK_VERSION_NAME
string[] dumpPackageInfoCommand = new string[] { "-d shell dumpsys package", transitionPackageName };
string packageInfo;
if (adbTool.RunCommand(dumpPackageInfoCommand, null, out packageInfo, out error) == 0 &&
!string.IsNullOrEmpty(packageInfo) &&
packageInfo.Contains(OVRBundleManager.TRANSITION_APK_VERSION_NAME))
{
// Matched package name found, and the package info contains TRANSITION_APK_VERSION_NAME
currentApkStatus = ApkStatus.OK;
}
else
{
currentApkStatus = ApkStatus.NOT_INSTALLED;
}
}
}
else
{
// No matached package name returned
currentApkStatus = ApkStatus.NOT_INSTALLED;
}
}
}
else if (error.Contains("no devices found"))
{
currentApkStatus = ApkStatus.DEVICE_NOT_CONNECTED;
}
else
{
currentApkStatus = ApkStatus.UNKNOWN;
}
}
}
private static void CheckForDeployedScenes()
{
if (buildableScenes == null) return;
UpdateSceneBuildStatus(SceneBundleStatus.UNKNOWN);
string[] deployedBundleNames = OVRBundleManager.ListRemoteAssetBundleNames();
if (deployedBundleNames == null) return;
for (int i = 0; i < buildableScenes.Count; ++i)
{
string sceneBundleName = "scene_" + buildableScenes[i].sceneName;
if (Array.FindIndex(deployedBundleNames, x => x.Equals(sceneBundleName, StringComparison.CurrentCultureIgnoreCase)) != -1)
{
UpdateSceneBuildStatus(SceneBundleStatus.DEPLOYED, i);
}
}
}
public static void PrintLog(string message, bool clear = false)
{
if (clear)
{
toolLog = message;
}
else
{
toolLog += message + "\n";
}
if (logBoxStyle != null)
{
GUIContent logContent = new GUIContent(toolLog);
logBoxSize = logBoxStyle.CalcSize(logContent);
debugLogScroll.y = float.MaxValue; //scroll to bottom on new data
}
}
public static void PrintError(string error = "")
{
if(!string.IsNullOrEmpty(error))
{
toolLog += "<color=red>Failed!\n</color>" + error + "\n";
}
else
{
toolLog += "<color=red>Failed! Check Unity log for more details.\n</color>";
}
}
public static void PrintWarning(string warning)
{
toolLog += "<color=yellow>Warning!\n" + warning + "</color>\n";
}
public static void PrintSuccess()
{
toolLog += "<color=green>Success!</color>\n";
}
public static string GetEnumDescription(Enum eEnum)
{
Type enumType = eEnum.GetType();
MemberInfo[] memberInfo = enumType.GetMember(eEnum.ToString());
if (memberInfo != null && memberInfo.Length > 0)
{
var attrs = memberInfo[0].GetCustomAttributes(typeof(DescriptionAttribute), false);
if (attrs != null && attrs.Length > 0)
{
return ((DescriptionAttribute)attrs[0]).Description;
}
}
return eEnum.ToString();
}
public static bool GetUseOptionalTransitionApkPackage()
{
return useOptionalTransitionApkPackage;
}
}
#endif

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 0c27664370189a44bae1f4a8aba8b7ff
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,203 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* Licensed under the Oculus SDK License Agreement (the "License");
* you may not use the Oculus SDK except in compliance with the License,
* which is provided at the time of installation or download, or which
* otherwise accompanies this software in either electronic or hard copy form.
*
* You may obtain a copy of the License at
*
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Oculus SDK
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.IO;
using System;
// OVRConfig inherits from ScriptableObject for legacy reasons. Conceptually,
// it's just a static class with path fetching helper methods. However, it
// used to serialize path data. When the serialized fields were no longer
// needed, we kept the ScriptableObject inheritence so as to not break backwards
// compatibility for existing projects that upgrade OVRPlugin versions.
#if UNITY_EDITOR
[UnityEditor.InitializeOnLoad]
#endif
public class OVRConfig : ScriptableObject
{
private static OVRConfig instance;
public static OVRConfig Instance
{
get
{
if (instance == null)
{
instance = Resources.Load<OVRConfig>("OVRConfig");
if (instance == null)
{
instance = ScriptableObject.CreateInstance<OVRConfig>();
string resourcePath = Path.Combine(UnityEngine.Application.dataPath, "Resources");
if (!Directory.Exists(resourcePath))
{
UnityEditor.AssetDatabase.CreateFolder("Assets", "Resources");
}
string fullPath = Path.Combine(Path.Combine("Assets", "Resources"), "OVRBuildConfig.asset");
UnityEditor.AssetDatabase.CreateAsset(instance, fullPath);
}
}
return instance;
}
set
{
instance = value;
}
}
// Returns the path to the base directory of the Android SDK
public string GetAndroidSDKPath(bool throwError = true)
{
string androidSDKPath = "";
#if UNITY_2019_1_OR_NEWER
// Check for use of embedded path or user defined
bool useEmbedded = EditorPrefs.GetBool("SdkUseEmbedded") || string.IsNullOrEmpty(EditorPrefs.GetString("AndroidSdkRoot"));
if (useEmbedded)
{
androidSDKPath = Path.Combine(BuildPipeline.GetPlaybackEngineDirectory(BuildTarget.Android, BuildOptions.None), "SDK");
}
else
#endif
{
androidSDKPath = EditorPrefs.GetString("AndroidSdkRoot");
}
androidSDKPath = androidSDKPath.Replace("/", "\\");
// Validate sdk path and notify user if path does not exist.
if (!Directory.Exists(androidSDKPath))
{
androidSDKPath = Environment.GetEnvironmentVariable("ANDROID_SDK_ROOT");
if (!string.IsNullOrEmpty(androidSDKPath))
{
return androidSDKPath;
}
if (throwError)
{
EditorUtility.DisplayDialog("Android SDK not Found",
"Android SDK not found. Please ensure that the path is set correctly in (Edit -> Preferences -> External Tools) or that the Untiy Android module is installed correctly.",
"Ok");
}
return string.Empty;
}
return androidSDKPath;
}
// Returns the path to the gradle-launcher-*.jar
public string GetGradlePath(bool throwError = true)
{
string gradlePath = "";
string libPath = "";
#if UNITY_2019_1_OR_NEWER
// Check for use of embedded path or user defined
bool useEmbedded = EditorPrefs.GetBool("GradleUseEmbedded") || string.IsNullOrEmpty(EditorPrefs.GetString("GradlePath"));
if (useEmbedded)
{
libPath = Path.Combine(BuildPipeline.GetPlaybackEngineDirectory(BuildTarget.Android, BuildOptions.None), "Tools\\gradle\\lib");
}
else
{
libPath = Path.Combine(EditorPrefs.GetString("GradlePath"), "lib");
}
#else
libPath = Path.Combine(EditorApplication.applicationContentsPath, "PlaybackEngines\\AndroidPlayer\\Tools\\gradle\\lib");
#endif
libPath = libPath.Replace("/", "\\");
if (!string.IsNullOrEmpty(libPath) && Directory.Exists(libPath))
{
string[] gradleJar = Directory.GetFiles(libPath, "gradle-launcher-*.jar");
if (gradleJar.Length == 1)
{
gradlePath = gradleJar[0];
}
}
// Validate gradle path and notify user if path does not exist.
if (!File.Exists(gradlePath))
{
if (throwError)
{
EditorUtility.DisplayDialog("Gradle not Found",
"Gradle not found. Please ensure that the path is set correctly in (Edit -> Preferences -> External Tools) or that the Untiy Android module is installed correctly.",
"Ok");
}
return string.Empty;
}
return gradlePath;
}
// Returns path to the Java executable in the JDK
public string GetJDKPath(bool throwError = true)
{
string jdkPath = "";
#if UNITY_EDITOR_WIN
// Check for use of embedded path or user defined
bool useEmbedded = EditorPrefs.GetBool("JdkUseEmbedded") || string.IsNullOrEmpty(EditorPrefs.GetString("JdkPath"));
string exePath = "";
if (useEmbedded)
{
#if UNITY_2019_1_OR_NEWER
exePath = Path.Combine(BuildPipeline.GetPlaybackEngineDirectory(BuildTarget.Android, BuildOptions.None), "Tools\\OpenJDK\\Windows\\bin");
#else
exePath = Path.Combine(EditorApplication.applicationContentsPath, "PlaybackEngines\\AndroidPlayer\\Tools\\OpenJDK\\Windows\\bin");
#endif
}
else
{
exePath = Path.Combine(EditorPrefs.GetString("JdkPath"), "bin");
}
jdkPath = Path.Combine(exePath, "java.exe");
jdkPath = jdkPath.Replace("/", "\\");
// Validate gradle path and notify user if path does not exist.
if (!File.Exists(jdkPath))
{
// Check the enviornment variable as a backup to see if the JDK is there.
string javaHome = Environment.GetEnvironmentVariable("JAVA_HOME");
if(!string.IsNullOrEmpty(javaHome))
{
jdkPath = Path.Combine(javaHome, "bin\\java.exe");
if(File.Exists(jdkPath))
{
return jdkPath;
}
}
if (throwError)
{
EditorUtility.DisplayDialog("JDK not Found",
"JDK not found. Please ensure that the path is set correctly in (Edit -> Preferences -> External Tools) or that the Untiy Android module is installed correctly.",
"Ok");
}
return string.Empty;
}
#endif
return jdkPath;
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 20553fac56ec59645857c0732b787431
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,68 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* Licensed under the Oculus SDK License Agreement (the "License");
* you may not use the Oculus SDK except in compliance with the License,
* which is provided at the time of installation or download, or which
* otherwise accompanies this software in either electronic or hard copy form.
*
* You may obtain a copy of the License at
*
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Oculus SDK
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
#if PRIORITIZE_OCULUS_XR_SETTINGS
using Unity.XR.Oculus;
#endif
public class OVRDeviceSelector
{
public static bool isTargetDeviceQuestFamily
{
get
{
return isTargetDeviceQuest || isTargetDeviceQuest2;
}
}
public static bool isTargetDeviceQuest
{
get
{
#if PRIORITIZE_OCULUS_XR_SETTINGS
OculusSettings settings;
UnityEditor.EditorBuildSettings.TryGetConfigObject<OculusSettings>("Unity.XR.Oculus.Settings", out settings);
return settings.TargetQuest;
#else
OVRProjectConfig projectConfig = OVRProjectConfig.GetProjectConfig();
return projectConfig.targetDeviceTypes.Contains(OVRProjectConfig.DeviceType.Quest);
#endif
}
}
public static bool isTargetDeviceQuest2
{
get
{
#if PRIORITIZE_OCULUS_XR_SETTINGS
OculusSettings settings;
UnityEditor.EditorBuildSettings.TryGetConfigObject<OculusSettings>("Unity.XR.Oculus.Settings", out settings);
return settings.TargetQuest2;
#else
OVRProjectConfig projectConfig = OVRProjectConfig.GetProjectConfig();
return projectConfig.targetDeviceTypes.Contains(OVRProjectConfig.DeviceType.Quest2);
#endif
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 157dce969e882084080e0a2c39efe398
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,242 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* Licensed under the Oculus SDK License Agreement (the "License");
* you may not use the Oculus SDK except in compliance with the License,
* which is provided at the time of installation or download, or which
* otherwise accompanies this software in either electronic or hard copy form.
*
* You may obtain a copy of the License at
*
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Oculus SDK
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Text.RegularExpressions;
using System;
public class DirectorySyncer
{
public delegate void SyncResultDelegate(SyncResult syncResult);
public readonly string Source;
public readonly string Target;
public SyncResultDelegate WillPerformOperations;
private readonly Regex _ignoreExpression;
// helper classes to simplify transition beyond .NET runtime 3.5
public abstract class CancellationToken
{
protected abstract bool _IsCancellationRequested();
public virtual bool IsCancellationRequested
{
get { return _IsCancellationRequested(); }
}
public void ThrowIfCancellationRequested()
{
if (IsCancellationRequested)
{
throw new Exception("Operation Cancelled");
}
}
public static readonly CancellationToken None = new CancellationTokenNone();
private class CancellationTokenNone : CancellationToken
{
protected override bool _IsCancellationRequested()
{
return false;
}
}
}
public class CancellationTokenSource : CancellationToken
{
private bool _isCancelled;
protected override bool _IsCancellationRequested()
{
return _isCancelled;
}
public void Cancel()
{
_isCancelled = true;
}
public CancellationToken Token
{
get { return this; }
}
}
private static string EnsureTrailingDirectorySeparator(string path)
{
return path.EndsWith("" + Path.DirectorySeparatorChar)
? path
: path + Path.DirectorySeparatorChar;
}
private static string CheckedDirectory(string nameInExceptionText, string directory)
{
directory = Path.GetFullPath(directory);
if (!Directory.Exists(directory))
{
throw new ArgumentException(string.Format("{0} is not a valid directory for argument ${1}", directory,
nameInExceptionText));
}
return EnsureTrailingDirectorySeparator(directory);
}
public DirectorySyncer(string source, string target, string ignoreRegExPattern = null)
{
Source = CheckedDirectory("source", source);
Target = CheckedDirectory("target", target);
if (Source.StartsWith(Target, StringComparison.OrdinalIgnoreCase) ||
Target.StartsWith(Source, StringComparison.OrdinalIgnoreCase))
{
throw new ArgumentException(string.Format("Paths must not contain each other (source: {0}, target: {1}",
Source, Target));
}
ignoreRegExPattern = ignoreRegExPattern ?? "^$";
_ignoreExpression = new Regex(ignoreRegExPattern, RegexOptions.IgnoreCase);
}
public class SyncResult
{
public readonly IEnumerable<string> Created;
public readonly IEnumerable<string> Updated;
public readonly IEnumerable<string> Deleted;
public SyncResult(IEnumerable<string> created, IEnumerable<string> updated, IEnumerable<string> deleted)
{
Created = created;
Updated = updated;
Deleted = deleted;
}
}
public bool RelativeFilePathIsRelevant(string relativeFilename)
{
return !_ignoreExpression.IsMatch(relativeFilename);
}
public bool RelativeDirectoryPathIsRelevant(string relativeDirName)
{
// Since our ignore patterns look at file names, they may contain trailing path separators
// In order for paths to match those rules, we add a path separator here
return !_ignoreExpression.IsMatch(EnsureTrailingDirectorySeparator(relativeDirName));
}
private HashSet<string> RelevantRelativeFilesBeneathDirectory(string path, CancellationToken cancellationToken)
{
return new HashSet<string>(Directory.GetFiles(path, "*", SearchOption.AllDirectories)
.TakeWhile((s) => !cancellationToken.IsCancellationRequested)
.Select(p => PathHelper.MakeRelativePath(path, p)).Where(RelativeFilePathIsRelevant));
}
private HashSet<string> RelevantRelativeDirectoriesBeneathDirectory(string path,
CancellationToken cancellationToken)
{
return new HashSet<string>(Directory.GetDirectories(path, "*", SearchOption.AllDirectories)
.TakeWhile((s) => !cancellationToken.IsCancellationRequested)
.Select(p => PathHelper.MakeRelativePath(path, p)).Where(RelativeDirectoryPathIsRelevant));
}
public SyncResult Synchronize()
{
return Synchronize(CancellationToken.None);
}
private void DeleteOutdatedFilesFromTarget(SyncResult syncResult, CancellationToken cancellationToken)
{
var outdatedFiles = syncResult.Updated.Union(syncResult.Deleted);
foreach (var fileName in outdatedFiles)
{
File.Delete(Path.Combine(Target, fileName));
cancellationToken.ThrowIfCancellationRequested();
}
}
[SuppressMessage("ReSharper", "ParameterTypeCanBeEnumerable.Local")]
private void DeleteOutdatedEmptyDirectoriesFromTarget(HashSet<string> sourceDirs, HashSet<string> targetDirs,
CancellationToken cancellationToken)
{
var deleted = targetDirs.Except(sourceDirs).OrderByDescending(s => s);
// By sorting in descending order above, we delete leaf-first,
// this is simpler than collapsing the list above (which would also allow us to run these ops in parallel).
// Assumption is that there are few empty folders to delete
foreach (var dir in deleted)
{
Directory.Delete(Path.Combine(Target, dir));
cancellationToken.ThrowIfCancellationRequested();
}
}
[SuppressMessage("ReSharper", "ParameterTypeCanBeEnumerable.Local")]
private void CreateRelevantDirectoriesAtTarget(HashSet<string> sourceDirs, HashSet<string> targetDirs,
CancellationToken cancellationToken)
{
var created = sourceDirs.Except(targetDirs);
foreach (var dir in created)
{
Directory.CreateDirectory(Path.Combine(Target, dir));
cancellationToken.ThrowIfCancellationRequested();
}
}
private void MoveRelevantFilesToTarget(SyncResult syncResult, CancellationToken cancellationToken)
{
// step 3: we move all new files to target
var newFiles = syncResult.Created.Union(syncResult.Updated);
foreach (var fileName in newFiles)
{
var sourceFileName = Path.Combine(Source, fileName);
var destFileName = Path.Combine(Target, fileName);
// target directory exists due to step CreateRelevantDirectoriesAtTarget()
File.Move(sourceFileName, destFileName);
cancellationToken.ThrowIfCancellationRequested();
}
}
public SyncResult Synchronize(CancellationToken cancellationToken)
{
var sourceDirs = RelevantRelativeDirectoriesBeneathDirectory(Source, cancellationToken);
var targetDirs = RelevantRelativeDirectoriesBeneathDirectory(Target, cancellationToken);
var sourceFiles = RelevantRelativeFilesBeneathDirectory(Source, cancellationToken);
var targetFiles = RelevantRelativeFilesBeneathDirectory(Target, cancellationToken);
var created = sourceFiles.Except(targetFiles).OrderBy(s => s).ToList();
var updated = sourceFiles.Intersect(targetFiles).OrderBy(s => s).ToList();
var deleted = targetFiles.Except(sourceFiles).OrderBy(s => s).ToList();
var syncResult = new SyncResult(created, updated, deleted);
if (WillPerformOperations != null)
{
WillPerformOperations.Invoke(syncResult);
}
DeleteOutdatedFilesFromTarget(syncResult, cancellationToken);
DeleteOutdatedEmptyDirectoriesFromTarget(sourceDirs, targetDirs, cancellationToken);
CreateRelevantDirectoriesAtTarget(sourceDirs, targetDirs, cancellationToken);
MoveRelevantFilesToTarget(syncResult, cancellationToken);
return syncResult;
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 666774827ce57754f9fbd8e008ed0a2a
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,199 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* Licensed under the Oculus SDK License Agreement (the "License");
* you may not use the Oculus SDK except in compliance with the License,
* which is provided at the time of installation or download, or which
* otherwise accompanies this software in either electronic or hard copy form.
*
* You may obtain a copy of the License at
*
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Oculus SDK
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if USING_XR_MANAGEMENT && (USING_XR_SDK_OCULUS || USING_XR_SDK_OPENXR)
#define USING_XR_SDK
#endif
#if UNITY_2020_1_OR_NEWER
#define REQUIRES_XR_SDK
#endif
using UnityEngine;
using UnityEditor;
using UnityEditor.Callbacks;
using System;
using System.IO;
[InitializeOnLoad]
class OVREngineConfigurationUpdater
{
private const string prefName = "OVREngineConfigurationUpdater_Enabled";
private const string menuItemName = "Oculus/Tools/Use Required Project Settings";
private const string androidAssetsPath = "Assets/Plugins/Android/assets";
private const string androidManifestPath = "Assets/Plugins/Android/AndroidManifest.xml";
static bool setPrefsForUtilities;
[MenuItem(menuItemName)]
static void ToggleUtilities()
{
setPrefsForUtilities = !setPrefsForUtilities;
Menu.SetChecked(menuItemName, setPrefsForUtilities);
int newValue = (setPrefsForUtilities) ? 1 : 0;
PlayerPrefs.SetInt(prefName, newValue);
PlayerPrefs.Save();
Debug.Log("Using required project settings: " + setPrefsForUtilities);
}
private static readonly string dashSupportEnableConfirmedKey = "Oculus_Utilities_OVREngineConfiguration_DashSupportEnableConfirmed_" + Application.unityVersion + OVRManager.utilitiesVersion;
private static bool dashSupportEnableConfirmed
{
get
{
return PlayerPrefs.GetInt(dashSupportEnableConfirmedKey, 0) == 1;
}
set
{
PlayerPrefs.SetInt(dashSupportEnableConfirmedKey, value ? 1 : 0);
}
}
static OVREngineConfigurationUpdater()
{
EditorApplication.delayCall += OnDelayCall;
EditorApplication.update += OnUpdate;
}
static void OnDelayCall()
{
setPrefsForUtilities = PlayerPrefs.GetInt(prefName, 1) != 0;
Menu.SetChecked(menuItemName, setPrefsForUtilities);
if (!setPrefsForUtilities)
return;
OVRPlugin.AddCustomMetadata("build_target", EditorUserBuildSettings.activeBuildTarget.ToString());
EnforceAndroidSettings();
}
static void OnUpdate()
{
if (!setPrefsForUtilities)
return;
EnforceBundleId();
EnforceVRSupport();
EnforceInstallLocation();
}
static void EnforceAndroidSettings()
{
if (EditorUserBuildSettings.activeBuildTarget != BuildTarget.Android)
return;
if (PlayerSettings.defaultInterfaceOrientation != UIOrientation.LandscapeLeft)
{
Debug.Log("OVREngineConfigurationUpdater: Setting orientation to Landscape Left");
// Default screen orientation must be set to landscape left.
PlayerSettings.defaultInterfaceOrientation = UIOrientation.LandscapeLeft;
}
#if !USING_XR_SDK && !REQUIRES_XR_SDK
#pragma warning disable 618
if (!PlayerSettings.virtualRealitySupported)
#pragma warning restore 618
{
// NOTE: This value should not affect the main window surface
// when Built-in VR support is enabled.
// NOTE: On Adreno Lollipop, it is an error to have antiAliasing set on the
// main window surface with front buffer rendering enabled. The view will
// render black.
// On Adreno KitKat, some tiling control modes will cause the view to render
// black.
if (QualitySettings.antiAliasing != 0 && QualitySettings.antiAliasing != 1)
{
Debug.Log("OVREngineConfigurationUpdater: Disabling antiAliasing");
QualitySettings.antiAliasing = 1;
}
}
#endif
if (QualitySettings.vSyncCount != 0)
{
Debug.Log("OVREngineConfigurationUpdater: Setting vsyncCount to 0");
// We sync in the TimeWarp, so we don't want unity syncing elsewhere.
QualitySettings.vSyncCount = 0;
}
}
static void EnforceVRSupport()
{
#if !USING_XR_SDK && !REQUIRES_XR_SDK
#pragma warning disable 618
if (PlayerSettings.virtualRealitySupported)
#pragma warning restore 618
return;
var mgrs = GameObject.FindObjectsOfType<OVRManager>();
for (int i = 0; i < mgrs.Length; ++i)
{
if (mgrs [i].isActiveAndEnabled)
{
Debug.Log ("Enabling Unity VR support");
#pragma warning disable 618
PlayerSettings.virtualRealitySupported = true;
#pragma warning restore 618
bool oculusFound = false;
foreach (var device in UnityEngine.XR.XRSettings.supportedDevices)
oculusFound |= (device == "Oculus");
if (!oculusFound)
Debug.LogError("Please add Oculus to the list of supported devices to use the Utilities.");
return;
}
}
#endif
}
private static void EnforceBundleId()
{
#if !USING_XR_SDK && !REQUIRES_XR_SDK
#pragma warning disable 618
if (!PlayerSettings.virtualRealitySupported)
{
return;
}
#pragma warning restore 618
#endif
#if USING_XR_SDK || !REQUIRES_XR_SDK
if (PlayerSettings.applicationIdentifier == "" || PlayerSettings.applicationIdentifier == "com.Company.ProductName")
{
string defaultBundleId = "com.oculus.UnitySample";
Debug.LogWarning("\"" + PlayerSettings.applicationIdentifier + "\" is not a valid bundle identifier. Defaulting to \"" + defaultBundleId + "\".");
PlayerSettings.applicationIdentifier = defaultBundleId;
}
#endif
}
private static void EnforceInstallLocation()
{
if (PlayerSettings.Android.preferredInstallLocation != AndroidPreferredInstallLocation.Auto)
PlayerSettings.Android.preferredInstallLocation = AndroidPreferredInstallLocation.Auto;
}
}

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: c86538ded11bfe24c8c79818bb9ea66a
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:

View File

@ -1,116 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* Licensed under the Oculus SDK License Agreement (the "License");
* you may not use the Oculus SDK except in compliance with the License,
* which is provided at the time of installation or download, or which
* otherwise accompanies this software in either electronic or hard copy form.
*
* You may obtain a copy of the License at
*
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Oculus SDK
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.IO;
using System.Xml;
using UnityEngine;
using UnityEditor;
public class BuildAssetBundles : MonoBehaviour
{
[MenuItem("Oculus/Tools/Build Mobile-Quest Expansion File", false, 100000)]
public static void BuildBundles()
{
// Create expansion file directory and call build asset bundles
string path = Application.dataPath + "/../Asset Bundles/";
if (!System.IO.Directory.Exists(path))
{
System.IO.Directory.CreateDirectory(path);
}
BuildPipeline.BuildAssetBundles(path, BuildAssetBundleOptions.ChunkBasedCompression, BuildTarget.Android);
// Rename asset bundle file to the proper obb string
if (File.Exists(path + "Asset Bundles"))
{
string expansionName = "main." + PlayerSettings.Android.bundleVersionCode + "." + PlayerSettings.applicationIdentifier + ".obb";
try
{
if (File.Exists(path + expansionName))
{
File.Delete(path + expansionName);
}
File.Move(path + "Asset Bundles", path + expansionName);
UnityEngine.Debug.Log("OBB expansion file " + expansionName + " has been successfully created at " + path);
UpdateAndroidManifest();
}
catch (Exception e)
{
UnityEngine.Debug.LogError(e.Message);
}
}
}
public static void UpdateAndroidManifest()
{
string manifestFolder = Application.dataPath + "/Plugins/Android";
try
{
// Load android manfiest file
XmlDocument doc = new XmlDocument();
doc.Load(manifestFolder + "/AndroidManifest.xml");
string androidNamepsaceURI;
XmlElement element = (XmlElement)doc.SelectSingleNode("/manifest");
if(element == null)
{
UnityEngine.Debug.LogError("Could not find manifest tag in android manifest.");
return;
}
// Get android namespace URI from the manifest
androidNamepsaceURI = element.GetAttribute("xmlns:android");
if (!string.IsNullOrEmpty(androidNamepsaceURI))
{
// Check if the android manifest already has the read external storage permission
XmlNodeList nodeList = doc.SelectNodes("/manifest/application/uses-permission");
foreach (XmlElement e in nodeList)
{
string attr = e.GetAttribute("name", androidNamepsaceURI);
if (attr == "android.permission.READ_EXTERNAL_STORAGE")
{
UnityEngine.Debug.Log("Android manifest already has the proper permissions.");
return;
}
}
element = (XmlElement)doc.SelectSingleNode("/manifest/application");
if (element != null)
{
// Insert read external storage permission
XmlElement newElement = doc.CreateElement("uses-permission");
newElement.SetAttribute("name", androidNamepsaceURI, "android.permission.READ_EXTERNAL_STORAGE");
element.AppendChild(newElement);
doc.Save(manifestFolder + "/AndroidManifest.xml");
UnityEngine.Debug.Log("Successfully modified android manifest with external storage permission.");
return;
}
}
UnityEngine.Debug.LogError("Could not find android naemspace URI in android manifest.");
}
catch (Exception e)
{
UnityEngine.Debug.LogError(e.Message);
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: b2a0ba46d78379541a5f56225e034afa
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,449 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* Licensed under the Oculus SDK License Agreement (the "License");
* you may not use the Oculus SDK except in compliance with the License,
* which is provided at the time of installation or download, or which
* otherwise accompanies this software in either electronic or hard copy form.
*
* You may obtain a copy of the License at
*
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Oculus SDK
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
//#define BUILDSESSION
#if USING_XR_MANAGEMENT && (USING_XR_SDK_OCULUS || USING_XR_SDK_OPENXR)
#define USING_XR_SDK
#endif
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Xml;
using System.Diagnostics;
using System.Threading;
using UnityEditor;
using UnityEngine;
using UnityEngine.Rendering;
using UnityEditor.Build;
using UnityEditor.Build.Reporting;
#if UNITY_ANDROID
using UnityEditor.Android;
#endif
#if USING_XR_SDK_OPENXR
using UnityEngine.XR.OpenXR;
using UnityEditor.XR.OpenXR.Features;
#endif
[InitializeOnLoad]
public class OVRGradleGeneration
: IPreprocessBuildWithReport, IPostprocessBuildWithReport
#if UNITY_ANDROID
, IPostGenerateGradleAndroidProject
#endif
{
public OVRADBTool adbTool;
public Process adbProcess;
public int callbackOrder { get { return 3; } }
static private System.DateTime buildStartTime;
static private System.Guid buildGuid;
#if UNITY_ANDROID
public const string prefName = "OVRAutoIncrementVersionCode_Enabled";
private const string menuItemAutoIncVersion = "Oculus/Tools/Auto Increment Version Code";
static bool autoIncrementVersion = false;
#endif
static OVRGradleGeneration()
{
EditorApplication.delayCall += OnDelayCall;
}
static void OnDelayCall()
{
#if UNITY_ANDROID
autoIncrementVersion = PlayerPrefs.GetInt(prefName, 0) != 0;
Menu.SetChecked(menuItemAutoIncVersion, autoIncrementVersion);
#endif
}
#if UNITY_ANDROID
[MenuItem(menuItemAutoIncVersion)]
public static void ToggleUtilities()
{
autoIncrementVersion = !autoIncrementVersion;
Menu.SetChecked(menuItemAutoIncVersion, autoIncrementVersion);
int newValue = (autoIncrementVersion) ? 1 : 0;
PlayerPrefs.SetInt(prefName, newValue);
PlayerPrefs.Save();
UnityEngine.Debug.Log("Auto Increment Version Code: " + autoIncrementVersion);
}
#endif
public void OnPreprocessBuild(BuildReport report)
{
bool useOpenXR = OVRPluginUpdater.IsOVRPluginOpenXRActivated();
#if USING_XR_SDK_OPENXR
UnityEngine.Debug.LogWarning("The installation of Unity OpenXR Plugin is detected, which should NOT be used in production when developing Oculus apps for production. Please uninstall the package, and install the Oculus XR Plugin from the Package Manager.");
// OpenXR Plugin will remove all native plugins if they are not under the Feature folder. Include OVRPlugin to the build if OculusXRFeature is enabled.
var oculusXRFeature = FeatureHelpers.GetFeatureWithIdForBuildTarget(report.summary.platformGroup, Oculus.XR.OculusXRFeature.featureId);
if (oculusXRFeature.enabled)
{
if (!useOpenXR)
{
throw new BuildFailedException("OpenXR backend for Oculus Plugin is disabled, which is required to support Unity OpenXR Plugin. Please enable OpenXR backend for Oculus Plugin through the 'Oculus -> Tools -> OpenXR' menu.");
}
string ovrRootPath = OVRPluginUpdater.GetUtilitiesRootPath();
var importers = PluginImporter.GetAllImporters();
foreach (var importer in importers)
{
if (!importer.GetCompatibleWithPlatform(report.summary.platform))
continue;
string fullAssetPath = Path.Combine(Directory.GetCurrentDirectory(), importer.assetPath);
#if UNITY_EDITOR_WIN
fullAssetPath = fullAssetPath.Replace("/", "\\");
#endif
if (fullAssetPath.StartsWith(ovrRootPath) && fullAssetPath.Contains("OVRPlugin"))
{
UnityEngine.Debug.LogFormat("[Oculus] Native plugin included in build because of enabled OculusXRFeature: {0}", importer.assetPath);
importer.SetIncludeInBuildDelegate(path => true);
}
if (!fullAssetPath.StartsWith(ovrRootPath) && fullAssetPath.Contains("libopenxr_loader.so"))
{
UnityEngine.Debug.LogFormat("[Oculus] libopenxr_loader.so from other packages will be disabled because of enabled OculusXRFeature: {0}", importer.assetPath);
importer.SetIncludeInBuildDelegate(path => false);
}
}
}
else
{
UnityEngine.Debug.LogWarning("OculusXRFeature is not enabled in OpenXR Settings. Oculus Integration scripts will not be functional.");
}
#endif
#if UNITY_ANDROID && !(USING_XR_SDK && UNITY_2019_3_OR_NEWER)
// Generate error when Vulkan is selected as the perferred graphics API, which is not currently supported in Unity XR
if (!PlayerSettings.GetUseDefaultGraphicsAPIs(BuildTarget.Android))
{
GraphicsDeviceType[] apis = PlayerSettings.GetGraphicsAPIs(BuildTarget.Android);
if (apis.Length >= 1 && apis[0] == GraphicsDeviceType.Vulkan)
{
throw new BuildFailedException("The Vulkan Graphics API does not support XR in your configuration. To use Vulkan, you must use Unity 2019.3 or newer, and the XR Plugin Management.");
}
}
#endif
#if UNITY_ANDROID
#if USING_XR_SDK
if (useOpenXR)
{
UnityEngine.Debug.LogWarning("Oculus Utilities Plugin with OpenXR is being used, which is under experimental status");
if (PlayerSettings.colorSpace != ColorSpace.Linear)
{
throw new BuildFailedException("Oculus Utilities Plugin with OpenXR only supports linear lighting. Please set 'Rendering/Color Space' to 'Linear' in Player Settings");
}
}
#else
if (useOpenXR)
{
throw new BuildFailedException("Oculus Utilities Plugin with OpenXR only supports XR Plug-in Managmenent with Oculus XR Plugin.");
}
#endif
#endif
#if UNITY_ANDROID && USING_XR_SDK && !USING_COMPATIBLE_OCULUS_XR_PLUGIN_VERSION
if (PlayerSettings.Android.targetArchitectures != AndroidArchitecture.ARM64)
throw new BuildFailedException("Your project is using an Oculus XR Plugin version with known issues. Please navigate to the Package Manager and upgrade the Oculus XR Plugin to the latest verified version. When performing the upgrade" +
", you must first \"Remove\" the Oculus XR Plugin package, and then \"Install\" the package at the verified version. Be sure to remove, then install, not just upgrade.");
#endif
buildStartTime = System.DateTime.Now;
buildGuid = System.Guid.NewGuid();
#if BUILDSESSION
StreamWriter writer = new StreamWriter("build_session", false);
UnityEngine.Debug.LogFormat("Build Session: {0}", buildGuid.ToString());
writer.WriteLine(buildGuid.ToString());
writer.Close();
#endif
}
public void OnPostGenerateGradleAndroidProject(string path)
{
UnityEngine.Debug.Log("OVRGradleGeneration triggered.");
var targetOculusPlatform = new List<string>();
if (OVRDeviceSelector.isTargetDeviceQuestFamily)
{
targetOculusPlatform.Add("quest");
}
UnityEngine.Debug.LogFormat("QuestFamily = {0}: Quest = {1}, Quest2 = {2}",
OVRDeviceSelector.isTargetDeviceQuestFamily,
OVRDeviceSelector.isTargetDeviceQuest,
OVRDeviceSelector.isTargetDeviceQuest2);
OVRProjectConfig projectConfig = OVRProjectConfig.GetProjectConfig();
if (projectConfig != null && projectConfig.systemSplashScreen != null)
{
if (PlayerSettings.virtualRealitySplashScreen != null)
{
UnityEngine.Debug.LogWarning("Virtual Reality Splash Screen (in Player Settings) is active. It would be displayed after the system splash screen, before the first game frame be rendered.");
}
string splashScreenAssetPath = AssetDatabase.GetAssetPath(projectConfig.systemSplashScreen);
if (Path.GetExtension(splashScreenAssetPath).ToLower() != ".png")
{
throw new BuildFailedException("Invalid file format of System Splash Screen. It has to be a PNG file to be used by the Quest OS. The asset path: " + splashScreenAssetPath);
}
else
{
string sourcePath = splashScreenAssetPath;
string targetFolder = Path.Combine(path, "src/main/assets");
string targetPath = targetFolder + "/vr_splash.png";
UnityEngine.Debug.LogFormat("Copy splash screen asset from {0} to {1}", sourcePath, targetPath);
try
{
File.Copy(sourcePath, targetPath, true);
}
catch(Exception e)
{
throw new BuildFailedException(e.Message);
}
}
}
PatchAndroidManifest(path);
}
public void PatchAndroidManifest(string path)
{
string manifestFolder = Path.Combine(path, "src/main");
string file = manifestFolder + "/AndroidManifest.xml";
bool patchedSecurityConfig = false;
// If Enable NSC Config, copy XML file into gradle project
OVRProjectConfig projectConfig = OVRProjectConfig.GetProjectConfig();
if (projectConfig != null)
{
if (projectConfig.enableNSCConfig)
{
// If no custom xml security path is specified, look for the default location in the integrations package.
string securityConfigFile = projectConfig.securityXmlPath;
if (string.IsNullOrEmpty(securityConfigFile))
{
securityConfigFile = GetOculusProjectNetworkSecConfigPath();
}
else
{
Uri configUri = new Uri(Path.GetFullPath(securityConfigFile));
Uri projectUri = new Uri(Application.dataPath);
Uri relativeUri = projectUri.MakeRelativeUri(configUri);
securityConfigFile = relativeUri.ToString();
}
string xmlDirectory = Path.Combine(path, "src/main/res/xml");
try
{
if (!Directory.Exists(xmlDirectory))
{
Directory.CreateDirectory(xmlDirectory);
}
File.Copy(securityConfigFile, Path.Combine(xmlDirectory, "network_sec_config.xml"), true);
patchedSecurityConfig = true;
}
catch (Exception e)
{
UnityEngine.Debug.LogError(e.Message);
}
}
}
OVRManifestPreprocessor.PatchAndroidManifest(file, enableSecurity: patchedSecurityConfig);
}
private static string GetOculusProjectNetworkSecConfigPath()
{
var so = ScriptableObject.CreateInstance(typeof(OVRPluginUpdaterStub));
var script = MonoScript.FromScriptableObject(so);
string assetPath = AssetDatabase.GetAssetPath(script);
string editorDir = Directory.GetParent(assetPath).FullName;
string configAssetPath = Path.GetFullPath(Path.Combine(editorDir, "network_sec_config.xml"));
Uri configUri = new Uri(configAssetPath);
Uri projectUri = new Uri(Application.dataPath);
Uri relativeUri = projectUri.MakeRelativeUri(configUri);
return relativeUri.ToString();
}
public void OnPostprocessBuild(BuildReport report)
{
#if UNITY_ANDROID
if(autoIncrementVersion)
{
if((report.summary.options & BuildOptions.Development) == 0)
{
PlayerSettings.Android.bundleVersionCode++;
UnityEngine.Debug.Log("Incrementing version code to " + PlayerSettings.Android.bundleVersionCode);
}
}
bool isExporting = true;
foreach (var step in report.steps)
{
if (step.name.Contains("Compile scripts")
|| step.name.Contains("Building scenes")
|| step.name.Contains("Writing asset files")
|| step.name.Contains("Preparing APK resources")
|| step.name.Contains("Creating Android manifest")
|| step.name.Contains("Processing plugins")
|| step.name.Contains("Exporting project")
|| step.name.Contains("Building Gradle project"))
{
#if BUILDSESSION
UnityEngine.Debug.LogFormat("build_step_" + step.name.ToLower().Replace(' ', '_') + ": {0}", step.duration.TotalSeconds.ToString());
#endif
if(step.name.Contains("Building Gradle project"))
{
isExporting = false;
}
}
}
#endif
if (!report.summary.outputPath.Contains("OVRGradleTempExport"))
{
#if BUILDSESSION
UnityEngine.Debug.LogFormat("build_complete: {0}", (System.DateTime.Now - buildStartTime).TotalSeconds.ToString());
#endif
}
#if UNITY_ANDROID
if (!isExporting)
{
// Get the hosts path to Android SDK
if (adbTool == null)
{
adbTool = new OVRADBTool(OVRConfig.Instance.GetAndroidSDKPath(false));
}
if (adbTool.isReady)
{
// Check to see if there are any ADB devices connected before continuing.
List<string> devices = adbTool.GetDevices();
if(devices.Count == 0)
{
return;
}
// Clear current logs on device
Process adbClearProcess;
adbClearProcess = adbTool.RunCommandAsync(new string[] { "logcat --clear" }, null);
// Add a timeout if we cannot get a response from adb logcat --clear in time.
Stopwatch timeout = new Stopwatch();
timeout.Start();
while (!adbClearProcess.WaitForExit(100))
{
if (timeout.ElapsedMilliseconds > 2000)
{
adbClearProcess.Kill();
return;
}
}
// Check if existing ADB process is still running, kill if needed
if (adbProcess != null && !adbProcess.HasExited)
{
adbProcess.Kill();
}
// Begin thread to time upload and install
var thread = new Thread(delegate ()
{
TimeDeploy();
});
thread.Start();
}
}
#endif
}
#if UNITY_ANDROID
public bool WaitForProcess;
public bool TransferStarted;
public DateTime UploadStart;
public DateTime UploadEnd;
public DateTime InstallEnd;
public void TimeDeploy()
{
if (adbTool != null)
{
TransferStarted = false;
DataReceivedEventHandler outputRecieved = new DataReceivedEventHandler(
(s, e) =>
{
if (e.Data != null && e.Data.Length != 0 && !e.Data.Contains("\u001b"))
{
if (e.Data.Contains("free_cache"))
{
// Device recieved install command and is starting upload
UploadStart = System.DateTime.Now;
TransferStarted = true;
}
else if (e.Data.Contains("Running dexopt"))
{
// Upload has finished and Package Manager is starting install
UploadEnd = System.DateTime.Now;
}
else if (e.Data.Contains("dex2oat took"))
{
// Package Manager finished install
InstallEnd = System.DateTime.Now;
WaitForProcess = false;
}
else if (e.Data.Contains("W PackageManager"))
{
// Warning from Package Manager is a failure in the install process
WaitForProcess = false;
}
}
}
);
WaitForProcess = true;
adbProcess = adbTool.RunCommandAsync(new string[] { "logcat" }, outputRecieved);
Stopwatch transferTimeout = new Stopwatch();
transferTimeout.Start();
while (adbProcess != null && !adbProcess.WaitForExit(100))
{
if (!WaitForProcess)
{
adbProcess.Kill();
}
if (!TransferStarted && transferTimeout.ElapsedMilliseconds > 5000)
{
adbProcess.Kill();
}
}
}
}
#endif
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: ee7053149e3a159409d4deeb2f2e687f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,31 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* Licensed under the Oculus SDK License Agreement (the "License");
* you may not use the Oculus SDK except in compliance with the License,
* which is provided at the time of installation or download, or which
* otherwise accompanies this software in either electronic or hard copy form.
*
* You may obtain a copy of the License at
*
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Oculus SDK
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using UnityEditor;
using UnityEngine;
[CustomPropertyDrawer(typeof(OVRLayerAttribute))]
class LayerAttributeEditor : PropertyDrawer {
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
// One line of oxygen free code.
property.intValue = EditorGUI.LayerField(position, label, property.intValue);
}
}

View File

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 6c08392d306aac74a88ba571af63c985
timeCreated: 1499749379
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 7f6763ce4cfe57644a593d773ec6e3cb
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,469 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* Licensed under the Oculus SDK License Agreement (the "License");
* you may not use the Oculus SDK except in compliance with the License,
* which is provided at the time of installation or download, or which
* otherwise accompanies this software in either electronic or hard copy form.
*
* You may obtain a copy of the License at
*
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Oculus SDK
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using UnityEngine;
using UnityEditor;
using System.IO;
using System.Xml;
public class OVRManifestPreprocessor
{
[MenuItem("Oculus/Tools/Create store-compatible AndroidManifest.xml", false, 100000)]
public static void GenerateManifestForSubmission()
{
var so = ScriptableObject.CreateInstance(typeof(OVRPluginUpdaterStub));
var script = MonoScript.FromScriptableObject(so);
string assetPath = AssetDatabase.GetAssetPath(script);
string editorDir = Directory.GetParent(assetPath).FullName;
string srcFile = editorDir + "/AndroidManifest.OVRSubmission.xml";
if (!File.Exists(srcFile))
{
Debug.LogError("Cannot find Android manifest template for submission." +
" Please delete the OVR folder and reimport the Oculus Utilities.");
return;
}
string manifestFolder = Application.dataPath + "/Plugins/Android";
if (!Directory.Exists(manifestFolder))
Directory.CreateDirectory(manifestFolder);
string dstFile = manifestFolder + "/AndroidManifest.xml";
if (File.Exists(dstFile))
{
if (!EditorUtility.DisplayDialog("AndroidManifest.xml Already Exists!", "Would you like to replace the existing manifest with a new one? All modifications will be lost.", "Replace", "Cancel"))
{
return;
}
}
PatchAndroidManifest(srcFile, dstFile, false);
AssetDatabase.Refresh();
}
[MenuItem("Oculus/Tools/Update AndroidManifest.xml")]
public static void UpdateAndroidManifest()
{
string manifestFile = "Assets/Plugins/Android/AndroidManifest.xml";
if (!File.Exists(manifestFile))
{
Debug.LogError("Unable to update manifest because it does not exist! Run \"Create store-compatible AndroidManifest.xml\" first");
return;
}
if (!EditorUtility.DisplayDialog("Update AndroidManifest.xml", "This will overwrite all Oculus specific AndroidManifest Settings. Continue?", "Overwrite", "Cancel"))
{
return;
}
PatchAndroidManifest(manifestFile, skipExistingAttributes: false);
AssetDatabase.Refresh();
}
[MenuItem("Oculus/Tools/Remove AndroidManifest.xml")]
public static void RemoveAndroidManifest()
{
AssetDatabase.DeleteAsset("Assets/Plugins/Android/AndroidManifest.xml");
AssetDatabase.Refresh();
}
private static void AddOrRemoveTag(XmlDocument doc, string @namespace, string path, string elementName, string name, bool required, bool modifyIfFound, params string[] attrs) // name, value pairs
{
var nodes = doc.SelectNodes(path + "/" + elementName);
XmlElement element = null;
foreach (XmlElement e in nodes)
{
if (name == null || name == e.GetAttribute("name", @namespace))
{
element = e;
break;
}
}
if (required)
{
if (element == null)
{
var parent = doc.SelectSingleNode(path);
element = doc.CreateElement(elementName);
element.SetAttribute("name", @namespace, name);
parent.AppendChild(element);
}
for (int i = 0; i < attrs.Length; i += 2)
{
if (modifyIfFound || string.IsNullOrEmpty(element.GetAttribute(attrs[i], @namespace)))
{
if (attrs[i + 1] != null)
{
element.SetAttribute(attrs[i], @namespace, attrs[i + 1]);
}
else
{
element.RemoveAttribute(attrs[i], @namespace);
}
}
}
}
else
{
if (element != null && modifyIfFound)
{
element.ParentNode.RemoveChild(element);
}
}
}
public static void PatchAndroidManifest(string sourceFile, string destinationFile = null, bool skipExistingAttributes = true, bool enableSecurity = false)
{
if (destinationFile == null)
{
destinationFile = sourceFile;
}
bool modifyIfFound = !skipExistingAttributes;
try
{
// Load android manfiest file
XmlDocument doc = new XmlDocument();
doc.Load(sourceFile);
string androidNamespaceURI;
XmlElement element = (XmlElement)doc.SelectSingleNode("/manifest");
if (element == null)
{
UnityEngine.Debug.LogError("Could not find manifest tag in android manifest.");
return;
}
// Get android namespace URI from the manifest
androidNamespaceURI = element.GetAttribute("xmlns:android");
if (string.IsNullOrEmpty(androidNamespaceURI))
{
UnityEngine.Debug.LogError("Could not find Android Namespace in manifest.");
return;
}
ApplyRequiredManfiestTags(doc, androidNamespaceURI, modifyIfFound, enableSecurity);
ApplyFeatureManfiestTags(doc, androidNamespaceURI, modifyIfFound);
// The following manifest entries are all handled through Oculus XR SDK Plugin
#if !PRIORITIZE_OCULUS_XR_SETTINGS
ApplyOculusXRManifestTags(doc, androidNamespaceURI, modifyIfFound);
#endif
doc.Save(destinationFile);
}
catch (System.Exception e)
{
UnityEngine.Debug.LogException(e);
}
}
private static void ApplyRequiredManfiestTags(XmlDocument doc, string androidNamespaceURI, bool modifyIfFound, bool enableSecurity)
{
OVRProjectConfig projectConfig = OVRProjectConfig.GetProjectConfig();
AddOrRemoveTag(doc,
androidNamespaceURI,
"/manifest/application/activity/intent-filter",
"category",
"android.intent.category.LEANBACK_LAUNCHER",
required: false,
modifyIfFound: true); // always remove leanback launcher
// First add or remove headtracking flag if targeting Quest
AddOrRemoveTag(doc,
androidNamespaceURI,
"/manifest",
"uses-feature",
"android.hardware.vr.headtracking",
OVRDeviceSelector.isTargetDeviceQuestFamily,
true,
"version", "1",
"required", OVRProjectConfig.GetProjectConfig().allowOptional3DofHeadTracking ? "false" : "true");
// make sure android label and icon are set in the manifest
AddOrRemoveTag(doc,
androidNamespaceURI,
"/manifest",
"application",
null,
true,
modifyIfFound,
"label", "@string/app_name",
"icon", "@mipmap/app_icon",
// Disable allowBackup in manifest and add Android NSC XML file
"allowBackup", projectConfig.disableBackups ? "false" : "true",
"networkSecurityConfig", projectConfig.enableNSCConfig && enableSecurity ? "@xml/network_sec_config" : null
);
}
private static void ApplyFeatureManfiestTags(XmlDocument doc, string androidNamespaceURI, bool modifyIfFound)
{
OVRProjectConfig projectConfig = OVRProjectConfig.GetProjectConfig();
OVRRuntimeSettings runtimeSettings = OVRRuntimeSettings.GetRuntimeSettings();
//============================================================================
// Hand Tracking
// If Quest is the target device, add the handtracking manifest tags if needed
// Mapping of project setting to manifest setting:
// OVRProjectConfig.HandTrackingSupport.ControllersOnly => manifest entry not present
// OVRProjectConfig.HandTrackingSupport.ControllersAndHands => manifest entry present and required=false
// OVRProjectConfig.HandTrackingSupport.HandsOnly => manifest entry present and required=true
OVRProjectConfig.HandTrackingSupport targetHandTrackingSupport = OVRProjectConfig.GetProjectConfig().handTrackingSupport;
OVRProjectConfig.HandTrackingVersion targetHandTrackingVersion = OVRProjectConfig.GetProjectConfig().handTrackingVersion;
bool handTrackingEntryNeeded = OVRDeviceSelector.isTargetDeviceQuestFamily && (targetHandTrackingSupport != OVRProjectConfig.HandTrackingSupport.ControllersOnly);
bool handTrackingVersionEntryNeeded = handTrackingEntryNeeded && (targetHandTrackingVersion != OVRProjectConfig.HandTrackingVersion.Default);
string handTrackingVersionValue = (targetHandTrackingVersion == OVRProjectConfig.HandTrackingVersion.V2) ? "V2.0" : "V1.0";
AddOrRemoveTag(doc,
androidNamespaceURI,
"/manifest",
"uses-feature",
"oculus.software.handtracking",
handTrackingEntryNeeded,
modifyIfFound,
"required", (targetHandTrackingSupport == OVRProjectConfig.HandTrackingSupport.HandsOnly) ? "true" : "false");
AddOrRemoveTag(doc,
androidNamespaceURI,
"/manifest",
"uses-permission",
"com.oculus.permission.HAND_TRACKING",
handTrackingEntryNeeded,
modifyIfFound);
AddOrRemoveTag(doc,
androidNamespaceURI,
"/manifest/application",
"meta-data",
"com.oculus.handtracking.frequency",
handTrackingEntryNeeded,
modifyIfFound,
"value", projectConfig.handTrackingFrequency.ToString());
AddOrRemoveTag(doc,
androidNamespaceURI,
"/manifest/application",
"meta-data",
"com.oculus.handtracking.version",
handTrackingVersionEntryNeeded,
modifyIfFound,
"value", handTrackingVersionValue);
//============================================================================
// System Keyboard
AddOrRemoveTag(doc,
androidNamespaceURI,
"/manifest",
"uses-feature",
"oculus.software.overlay_keyboard",
projectConfig.requiresSystemKeyboard,
modifyIfFound,
"required", "false");
//============================================================================
// Experimental Features
AddOrRemoveTag(doc,
androidNamespaceURI,
"/manifest",
"uses-feature",
"com.oculus.experimental.enabled",
projectConfig.experimentalFeaturesEnabled,
modifyIfFound,
"required", "true");
//============================================================================
// Anchor
OVRProjectConfig.AnchorSupport targetAnchorSupport = OVRProjectConfig.GetProjectConfig().anchorSupport;
bool anchorEntryNeeded = OVRDeviceSelector.isTargetDeviceQuestFamily && (targetAnchorSupport == OVRProjectConfig.AnchorSupport.Enabled);
AddOrRemoveTag(doc,
androidNamespaceURI,
"/manifest",
"uses-permission",
"com.oculus.permission.USE_ANCHOR_API",
anchorEntryNeeded,
modifyIfFound);
//============================================================================
// Passthrough
AddOrRemoveTag(doc,
androidNamespaceURI,
"/manifest",
"uses-feature",
"com.oculus.feature.PASSTHROUGH",
projectConfig.insightPassthroughEnabled,
modifyIfFound,
"required", "true");
//============================================================================
// System Splash Screen
if (projectConfig.systemSplashScreen != null)
{
AddOrRemoveTag(doc,
androidNamespaceURI,
"/manifest/application",
"meta-data",
"com.oculus.ossplash",
true,
modifyIfFound,
"value", "true");
AddOrRemoveTag(doc,
androidNamespaceURI,
"/manifest/application",
"meta-data",
"com.oculus.ossplash.colorspace",
true,
modifyIfFound,
"value", ColorSpaceToManifestTag(runtimeSettings.colorSpace));
}
//============================================================================
// Render Model
OVRProjectConfig.RenderModelSupport renderModelSupport = OVRProjectConfig.GetProjectConfig().renderModelSupport;
bool renderModelEntryNeeded = OVRDeviceSelector.isTargetDeviceQuestFamily && (renderModelSupport == OVRProjectConfig.RenderModelSupport.Enabled);
AddOrRemoveTag(doc,
androidNamespaceURI,
"/manifest",
"uses-feature",
"com.oculus.feature.RENDER_MODEL",
renderModelEntryNeeded,
modifyIfFound);
AddOrRemoveTag(doc,
androidNamespaceURI,
"/manifest",
"uses-permission",
"com.oculus.permission.RENDER_MODEL",
renderModelEntryNeeded,
modifyIfFound);
//============================================================================
// Tracked Keyboard
// If Quest is the target device, add the tracked keyboard manifest tags if needed
// Mapping of project setting to manifest setting:
// OVRProjectConfig.TrackedKeyboardSupport.None => manifest entry not present
// OVRProjectConfig.TrackedKeyboardSupport.Supported => manifest entry present and required=false
// OVRProjectConfig.TrackedKeyboardSupport.Required => manifest entry present and required=true
OVRProjectConfig.TrackedKeyboardSupport targetTrackedKeyboardSupport = OVRProjectConfig.GetProjectConfig().trackedKeyboardSupport;
bool trackedKeyboardEntryNeeded = OVRDeviceSelector.isTargetDeviceQuestFamily && (targetTrackedKeyboardSupport != OVRProjectConfig.TrackedKeyboardSupport.None);
AddOrRemoveTag(doc,
androidNamespaceURI,
"/manifest",
"uses-feature",
"oculus.software.trackedkeyboard",
trackedKeyboardEntryNeeded,
modifyIfFound,
"required", (targetTrackedKeyboardSupport == OVRProjectConfig.TrackedKeyboardSupport.Required) ? "true" : "false");
AddOrRemoveTag(doc,
androidNamespaceURI,
"/manifest",
"uses-permission",
"com.oculus.permission.TRACKED_KEYBOARD",
trackedKeyboardEntryNeeded,
modifyIfFound);
}
private static void ApplyOculusXRManifestTags(XmlDocument doc, string androidNamespaceURI, bool modifyIfFound)
{
// Add focus aware tag if this app is targeting Quest Family
AddOrRemoveTag(doc,
androidNamespaceURI,
"/manifest/application/activity",
"meta-data",
"com.oculus.vr.focusaware",
OVRDeviceSelector.isTargetDeviceQuestFamily,
modifyIfFound,
"value", "true");
// Add support devices manifest according to the target devices
if (OVRDeviceSelector.isTargetDeviceQuestFamily)
{
string targetDeviceValue = "quest";
if (OVRDeviceSelector.isTargetDeviceQuest && OVRDeviceSelector.isTargetDeviceQuest2)
{
targetDeviceValue = "quest|quest2";
}
else if (OVRDeviceSelector.isTargetDeviceQuest2)
{
targetDeviceValue = "quest2";
}
else if (OVRDeviceSelector.isTargetDeviceQuest)
{
targetDeviceValue = "quest";
}
else
{
Debug.LogError("Unexpected target devices");
}
AddOrRemoveTag(doc,
androidNamespaceURI,
"/manifest/application",
"meta-data",
"com.oculus.supportedDevices",
true,
modifyIfFound,
"value", targetDeviceValue);
}
// Add VR intent filter tag in the manifest
AddOrRemoveTag(doc,
androidNamespaceURI,
"/manifest/application/activity/intent-filter",
"category",
"com.oculus.intent.category.VR",
required: true,
modifyIfFound: true);
}
private static string ColorSpaceToManifestTag(OVRManager.ColorSpace colorSpace)
{
switch (colorSpace)
{
case OVRManager.ColorSpace.Unmanaged:
return "!Unmanaged";
case OVRManager.ColorSpace.Rec_2020:
return "Rec.2020";
case OVRManager.ColorSpace.Rec_709:
return "Rec.709";
case OVRManager.ColorSpace.Rift_CV1:
return "!RiftCV1";
case OVRManager.ColorSpace.Rift_S:
return "!RiftS";
case OVRManager.ColorSpace.Quest:
return "!Quest";
case OVRManager.ColorSpace.P3:
return "P3";
case OVRManager.ColorSpace.Adobe_RGB:
return "Adobe";
default:
return "";
}
}
}

View File

@ -1,13 +0,0 @@
fileFormatVersion: 2
guid: fb6426f323b7f024ebb25886b5182c4c
timeCreated: 1462825988
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences:
- renderFrom: {fileID: 168286, guid: a5014611cefbb6b4398b7e4c82203d08, type: 2}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -1,13 +0,0 @@
fileFormatVersion: 2
guid: f6d58d9d4ff0e8f4ca5f73c5ec106551
timeCreated: 1536960564
licenseType: Store
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,600 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* Licensed under the Oculus SDK License Agreement (the "License");
* you may not use the Oculus SDK except in compliance with the License,
* which is provided at the time of installation or download, or which
* otherwise accompanies this software in either electronic or hard copy form.
*
* You may obtain a copy of the License at
*
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Oculus SDK
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using UnityEditor;
using UnityEngine;
namespace Assets.Oculus.VR.Editor
{
#if UNITY_EDITOR
[UnityEditor.InitializeOnLoad]
#endif
public sealed class OVRPlatformToolSettings : ScriptableObject
{
private const string DEFAULT_RELEASE_CHANNEL = "Alpha";
static OVRPlatformToolSettings()
{
// BuildPipeline.isBuildingPlayer cannot be called in a static constructor
// Run Update once to call TryInitialize then remove delegate
EditorApplication.update += Update;
}
static void Update()
{
// Initialize the instance only if a build is not currently running.
TryInitialize();
// Stop running Update
EditorApplication.update -= Update;
}
public static string AppID
{
get
{
if (Instance.targetPlatform < OVRPlatformTool.TargetPlatform.None &&
EditorPrefs.HasKey("OVRPlatformToolSettings_AppID" + (int)Instance.targetPlatform))
{
return EditorPrefs.GetString("OVRPlatformToolSettings_AppID" + (int)Instance.targetPlatform);
}
else
{
return "";
}
}
set
{
if (Instance.targetPlatform < OVRPlatformTool.TargetPlatform.None)
{
EditorPrefs.SetString("OVRPlatformToolSettings_AppID" + (int)Instance.targetPlatform, value);
}
}
}
public static string ReleaseNote
{
get
{
if (Instance.targetPlatform < OVRPlatformTool.TargetPlatform.None &&
EditorPrefs.HasKey("OVRPlatformToolSettings_ReleaseNote" + (int)Instance.targetPlatform))
{
return EditorPrefs.GetString("OVRPlatformToolSettings_ReleaseNote" + (int)Instance.targetPlatform);
}
else
{
return "";
}
}
set
{
if (Instance.targetPlatform < OVRPlatformTool.TargetPlatform.None)
{
EditorPrefs.SetString("OVRPlatformToolSettings_ReleaseNote" + (int)Instance.targetPlatform, value);
}
}
}
public static string ReleaseChannel
{
get
{
if (Instance.targetPlatform < OVRPlatformTool.TargetPlatform.None &&
EditorPrefs.HasKey("OVRPlatformToolSettings_ReleaseChannel" + (int)Instance.targetPlatform))
{
return EditorPrefs.GetString("OVRPlatformToolSettings_ReleaseChannel" + (int)Instance.targetPlatform);
}
else
{
return "";
}
}
set
{
if (Instance.targetPlatform < OVRPlatformTool.TargetPlatform.None)
{
EditorPrefs.SetString("OVRPlatformToolSettings_ReleaseChannel" + (int)Instance.targetPlatform, value);
}
}
}
public static string ApkBuildPath
{
get
{
if (Instance.targetPlatform < OVRPlatformTool.TargetPlatform.None &&
EditorPrefs.HasKey("OVRPlatformToolSettings_ApkBuildPath" + (int)Instance.targetPlatform))
{
return EditorPrefs.GetString("OVRPlatformToolSettings_ApkBuildPath" + (int)Instance.targetPlatform);
}
else
{
return "";
}
}
set
{
if (Instance.targetPlatform < OVRPlatformTool.TargetPlatform.None)
{
EditorPrefs.SetString("OVRPlatformToolSettings_ApkBuildPath" + (int)Instance.targetPlatform, value);
}
}
}
public static string ObbFilePath
{
get
{
if (Instance.targetPlatform < OVRPlatformTool.TargetPlatform.None &&
EditorPrefs.HasKey("OVRPlatformToolSettings_ObbFilePath" + (int)Instance.targetPlatform))
{
return EditorPrefs.GetString("OVRPlatformToolSettings_ObbFilePath" + (int)Instance.targetPlatform);
}
else
{
return "";
}
}
set
{
if (Instance.targetPlatform < OVRPlatformTool.TargetPlatform.None)
{
EditorPrefs.SetString("OVRPlatformToolSettings_ObbFilePath" + (int)Instance.targetPlatform, value);
}
}
}
public static string AssetsDirectory
{
get
{
if (Instance.targetPlatform < OVRPlatformTool.TargetPlatform.None &&
EditorPrefs.HasKey("OVRPlatformToolSettings_AssetsDirectory" + (int)Instance.targetPlatform))
{
return EditorPrefs.GetString("OVRPlatformToolSettings_AssetsDirectory" + (int)Instance.targetPlatform);
}
else
{
return "";
}
}
set
{
if (Instance.targetPlatform < OVRPlatformTool.TargetPlatform.None)
{
EditorPrefs.SetString("OVRPlatformToolSettings_AssetsDirectory" + (int)Instance.targetPlatform, value);
}
}
}
public static string RiftBuildDirectory
{
get
{
if (EditorPrefs.HasKey("OVRPlatformToolSettings_RiftBuildDirectory"))
{
return EditorPrefs.GetString("OVRPlatformToolSettings_RiftBuildDirectory");
}
else
{
return "";
}
}
set
{
EditorPrefs.SetString("OVRPlatformToolSettings_RiftBuildDirectory", value);
}
}
public static string RiftBuildVersion
{
get
{
if (EditorPrefs.HasKey("OVRPlatformToolSettings_RiftBuildVersion"))
{
return EditorPrefs.GetString("OVRPlatformToolSettings_RiftBuildVersion");
}
else
{
return "";
}
}
set
{
EditorPrefs.SetString("OVRPlatformToolSettings_RiftBuildVersion", value);
}
}
public static string RiftLaunchFile
{
get
{
if (EditorPrefs.HasKey("OVRPlatformToolSettings_RiftLaunchFile"))
{
return EditorPrefs.GetString("OVRPlatformToolSettings_RiftLaunchFile");
}
else
{
return "";
}
}
set
{
EditorPrefs.SetString("OVRPlatformToolSettings_RiftLaunchFile", value);
}
}
public static string RiftLaunchParams
{
get
{
if (EditorPrefs.HasKey("OVRPlatformToolSettings_RiftLaunchParams"))
{
return EditorPrefs.GetString("OVRPlatformToolSettings_RiftLaunchParams");
}
else
{
return "";
}
}
set
{
EditorPrefs.SetString("OVRPlatformToolSettings_RiftLaunchParams", value);
}
}
public static string Rift2DLaunchFile
{
get
{
if (EditorPrefs.HasKey("OVRPlatformToolSettings_Rift2DLaunchFile"))
{
return EditorPrefs.GetString("OVRPlatformToolSettings_Rift2DLaunchFile");
}
else
{
return "";
}
}
set
{
EditorPrefs.SetString("OVRPlatformToolSettings_Rift2DLaunchFile", value);
}
}
public static string Rift2DLaunchParams
{
get
{
if (EditorPrefs.HasKey("OVRPlatformToolSettings_Rift2DLaunchParams"))
{
return EditorPrefs.GetString("OVRPlatformToolSettings_Rift2DLaunchParams");
}
else
{
return "";
}
}
set
{
EditorPrefs.SetString("OVRPlatformToolSettings_Rift2DLaunchParams", value);
}
}
public static bool RiftFirewallException
{
get
{
if (EditorPrefs.HasKey("OVRPlatformToolSettings_RiftFirewallException"))
{
return EditorPrefs.GetBool("OVRPlatformToolSettings_RiftFirewallException");
}
else
{
return false;
}
}
set
{
EditorPrefs.SetBool("OVRPlatformToolSettings_RiftFirewallException", value);
}
}
public static OVRPlatformTool.GamepadType RiftGamepadEmulation
{
get
{
if (EditorPrefs.HasKey("OVRPlatformToolSettings_RiftGamepadEmulation"))
{
return (OVRPlatformTool.GamepadType)EditorPrefs.GetInt("OVRPlatformToolSettings_RiftGamepadEmulation");
}
else
{
return OVRPlatformTool.GamepadType.OFF;
}
}
set
{
EditorPrefs.SetInt("OVRPlatformToolSettings_RiftGamepadEmulation", (int)value);
}
}
public static List<RedistPackage> RiftRedistPackages
{
get { return Instance.riftRedistPackages; }
set { Instance.riftRedistPackages = value; }
}
public static string LanguagePackDirectory
{
get { return Instance.languagePackDirectory; }
set { Instance.languagePackDirectory = value; }
}
public static List<AssetConfig> AssetConfigs
{
get
{
return Instance.targetPlatform < OVRPlatformTool.TargetPlatform.None ? Instance.assetConfigs[(int)Instance.targetPlatform].configList : new List<AssetConfig>();
}
set
{
if (Instance.targetPlatform < OVRPlatformTool.TargetPlatform.None)
{
Instance.assetConfigs[(int)Instance.targetPlatform].configList = value;
}
}
}
public static OVRPlatformTool.TargetPlatform TargetPlatform
{
get { return Instance.targetPlatform; }
set { Instance.targetPlatform = value; }
}
public static bool RunOvrLint
{
get { return Instance.runOvrLint; }
set { Instance.runOvrLint = value; }
}
public static bool UploadDebugSymbols
{
get
{
if (EditorPrefs.HasKey("OVRPlatformToolSettings_UploadDebugSymbols"))
{
return EditorPrefs.GetBool("OVRPlatformToolSettings_UploadDebugSymbols");
}
else
{
return true;
}
}
set
{
EditorPrefs.SetBool("OVRPlatformToolSettings_UploadDebugSymbols", value);
}
}
public static string DebugSymbolsDirectory
{
get
{
if (EditorPrefs.HasKey("OVRPlatformToolSettings_DebugSymbolsDirectory"))
{
return EditorPrefs.GetString("OVRPlatformToolSettings_DebugSymbolsDirectory");
}
else
{
return "";
}
}
set
{
EditorPrefs.SetString("OVRPlatformToolSettings_DebugSymbolsDirectory", value);
}
}
public static bool UploadDebugSymbolsOnly
{
get
{
if (EditorPrefs.HasKey("OVRPlatformToolSettings_UploadDebugSymbolsOnly"))
{
return EditorPrefs.GetBool("OVRPlatformToolSettings_UploadDebugSymbolsOnly");
}
else
{
return false;
}
}
set
{
EditorPrefs.SetBool("OVRPlatformToolSettings_UploadDebugSymbolsOnly", value);
}
}
public static string BuildID
{
get
{
if (EditorPrefs.HasKey("OVRPlatformToolSettings_BuildID"))
{
return EditorPrefs.GetString("OVRPlatformToolSettings_BuildID");
}
else
{
return "";
}
}
set
{
EditorPrefs.SetString("OVRPlatformToolSettings_BuildID", value);
}
}
[SerializeField]
private List<RedistPackage> riftRedistPackages;
[SerializeField]
private string languagePackDirectory = "";
[SerializeField]
private AssetConfigList[] assetConfigs = new AssetConfigList[(int)OVRPlatformTool.TargetPlatform.None];
[SerializeField]
private OVRPlatformTool.TargetPlatform targetPlatform = OVRPlatformTool.TargetPlatform.None;
[SerializeField]
private bool runOvrLint = true;
public static bool TryInitialize()
{
// If not initialized and Build Player is current running, UnityEditor.AssetDatabase.CreateAsset
// is unsafe to call and will cause a crash. Only load the resource if it already exists.
if (instance == null && BuildPipeline.isBuildingPlayer)
{
instance = Resources.Load<OVRPlatformToolSettings>("OVRPlatformToolSettings");
return instance != null;
}
// Otherwise create/load the resource instance normally.
return Instance != null;
}
private static OVRPlatformToolSettings instance;
public static OVRPlatformToolSettings Instance
{
get
{
if (instance == null)
{
instance = Resources.Load<OVRPlatformToolSettings>("OVRPlatformToolSettings");
if (instance == null)
{
if (BuildPipeline.isBuildingPlayer)
{
// UnityEditor.AssetDatabase.CreateAsset is unsafe to call during a build and
// may cause a crash.
// This should be rare as the asset is created in the static constructor and should
// usually exist.
throw new UnityEditor.Build.BuildFailedException(
"Cannot create OVRPlatformToolSettings asset while building.");
}
instance = ScriptableObject.CreateInstance<OVRPlatformToolSettings>();
string properPath = System.IO.Path.Combine(UnityEngine.Application.dataPath, "Resources");
if (!System.IO.Directory.Exists(properPath))
{
UnityEditor.AssetDatabase.CreateFolder("Assets", "Resources");
}
string fullPath = System.IO.Path.Combine(
System.IO.Path.Combine("Assets", "Resources"),
"OVRPlatformToolSettings.asset"
);
UnityEditor.AssetDatabase.CreateAsset(instance, fullPath);
// Initialize cross platform default values for the new instance of OVRPlatformToolSettings here
if (instance != null)
{
for (int i = 0; i < (int)OVRPlatformTool.TargetPlatform.None; i++)
{
EditorPrefs.SetString("OVRPlatformToolSettings_ReleaseChannel" + i, DEFAULT_RELEASE_CHANNEL);
instance.assetConfigs[i] = new AssetConfigList();
}
instance.riftRedistPackages = new List<RedistPackage>();
}
}
}
return instance;
}
set
{
instance = value;
}
}
}
// Wrapper for asset config list so that it can be serialized properly
[System.Serializable]
public class AssetConfigList
{
public List<AssetConfig> configList;
public AssetConfigList()
{
configList = new List<AssetConfig>();
}
}
[System.Serializable]
public class AssetConfig
{
public enum AssetType
{
DEFAULT,
STORE,
LANGUAGE_PACK,
};
public string name;
public bool required;
public AssetType type;
public string sku;
private bool foldout;
public AssetConfig(string assetName)
{
name = assetName;
}
public bool GetFoldoutState()
{
return foldout;
}
public void SetFoldoutState(bool state)
{
foldout = state;
}
}
[System.Serializable]
public class RedistPackage
{
public bool include = false;
public string name;
public string id;
public RedistPackage(string pkgName, string pkgId)
{
name = pkgName;
id = pkgId;
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: cd7bb81df5b74b34dadbf531f381a26b
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

File diff suppressed because it is too large Load Diff

View File

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 9e64a3a065da39f4caa17a7372962df6
timeCreated: 1493086775
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,40 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* Licensed under the Oculus SDK License Agreement (the "License");
* you may not use the Oculus SDK except in compliance with the License,
* which is provided at the time of installation or download, or which
* otherwise accompanies this software in either electronic or hard copy form.
*
* You may obtain a copy of the License at
*
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Oculus SDK
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using UnityEngine;
using UnityEditor;
using System;
public class OVRPluginUpdaterStub : ScriptableObject
{
// Stub helper class to locate OVR Utilities Path through Unity Editor API.
// Required to be a standalone class in a separate file or else MonoScript.FromScriptableObject() returns an empty string path.
public static bool IsInsidePackageDistribution()
{
var so = ScriptableObject.CreateInstance(typeof(OVRPluginUpdaterStub));
var script = MonoScript.FromScriptableObject(so);
string assetPath = AssetDatabase.GetAssetPath(script);
if (assetPath.StartsWith("Packages\\", StringComparison.InvariantCultureIgnoreCase) ||
assetPath.StartsWith("Packages/", StringComparison.InvariantCultureIgnoreCase))
return true;
return false;
}
}

View File

@ -1,12 +0,0 @@
fileFormatVersion: 2
guid: 791840c2fc67dd3409b79f212fad7dd4
timeCreated: 1493148044
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,209 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* Licensed under the Oculus SDK License Agreement (the "License");
* you may not use the Oculus SDK except in compliance with the License,
* which is provided at the time of installation or download, or which
* otherwise accompanies this software in either electronic or hard copy form.
*
* You may obtain a copy of the License at
*
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Oculus SDK
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEditor;
using System.IO;
using System;
using UnityEngine.Serialization;
[System.Serializable]
#if UNITY_EDITOR
[UnityEditor.InitializeOnLoad]
#endif
public class OVRProjectConfig : ScriptableObject
{
public enum DeviceType
{
//GearVrOrGo = 0, // DEPRECATED
Quest = 1,
Quest2 = 2
}
public enum HandTrackingSupport
{
ControllersOnly = 0,
ControllersAndHands = 1,
HandsOnly = 2
}
public enum HandTrackingFrequency
{
LOW = 0,
HIGH = 1,
MAX = 2
}
public enum HandTrackingVersion
{
Default = 0,
V1 = 1,
V2 = 2
}
public enum AnchorSupport
{
Disabled = 0,
Enabled = 1,
}
public enum RenderModelSupport
{
Disabled = 0,
Enabled = 1,
}
public enum TrackedKeyboardSupport
{
None = 0,
Supported = 1,
Required = 2
}
public List<DeviceType> targetDeviceTypes = new List<DeviceType> {DeviceType.Quest, DeviceType.Quest2};
public bool allowOptional3DofHeadTracking = false;
public HandTrackingSupport handTrackingSupport = HandTrackingSupport.ControllersOnly;
public HandTrackingFrequency handTrackingFrequency = HandTrackingFrequency.LOW;
public HandTrackingVersion handTrackingVersion = HandTrackingVersion.Default;
[FormerlySerializedAs("spatialAnchorsSupport")]
public AnchorSupport anchorSupport = AnchorSupport.Disabled;
public RenderModelSupport renderModelSupport = RenderModelSupport.Disabled;
public TrackedKeyboardSupport trackedKeyboardSupport = TrackedKeyboardSupport.None;
public bool disableBackups = true;
public bool enableNSCConfig = true;
public string securityXmlPath;
public bool skipUnneededShaders = false;
[System.Obsolete("Focus awareness is now required. The option will be deprecated.", false)]
public bool focusAware = true;
public bool requiresSystemKeyboard = false;
public bool experimentalFeaturesEnabled = false;
public bool insightPassthroughEnabled = false;
public Texture2D systemSplashScreen;
//public const string OculusProjectConfigAssetPath = "Assets/Oculus/OculusProjectConfig.asset";
static OVRProjectConfig()
{
// BuildPipeline.isBuildingPlayer cannot be called in a static constructor
// Run Update once to call GetProjectConfig then remove delegate
EditorApplication.update += Update;
}
static void Update()
{
// Initialize the asset if it doesn't exist
GetProjectConfig();
// Stop running Update
EditorApplication.update -= Update;
}
private static string GetOculusProjectConfigAssetPath()
{
var so = ScriptableObject.CreateInstance(typeof(OVRPluginUpdaterStub));
var script = MonoScript.FromScriptableObject(so);
string assetPath = AssetDatabase.GetAssetPath(script);
string editorDir = Directory.GetParent(assetPath).FullName;
string ovrDir = Directory.GetParent(editorDir).FullName;
string oculusDir = Directory.GetParent(ovrDir).FullName;
if (OVRPluginUpdaterStub.IsInsidePackageDistribution())
{
oculusDir = Path.GetFullPath(Path.Combine(Application.dataPath, "Oculus"));
if (!Directory.Exists(oculusDir))
{
Directory.CreateDirectory(oculusDir);
}
}
string configAssetPath = Path.GetFullPath(Path.Combine(oculusDir, "OculusProjectConfig.asset"));
Uri configUri = new Uri(configAssetPath);
Uri projectUri = new Uri(Application.dataPath);
Uri relativeUri = projectUri.MakeRelativeUri(configUri);
return relativeUri.ToString();
}
public static OVRProjectConfig GetProjectConfig()
{
OVRProjectConfig projectConfig = null;
string oculusProjectConfigAssetPath = GetOculusProjectConfigAssetPath();
try
{
projectConfig = AssetDatabase.LoadAssetAtPath(oculusProjectConfigAssetPath, typeof(OVRProjectConfig)) as OVRProjectConfig;
}
catch (System.Exception e)
{
Debug.LogWarningFormat("Unable to load ProjectConfig from {0}, error {1}", oculusProjectConfigAssetPath, e.Message);
}
// Initialize the asset only if a build is not currently running.
if (projectConfig == null && !BuildPipeline.isBuildingPlayer)
{
projectConfig = ScriptableObject.CreateInstance<OVRProjectConfig>();
projectConfig.targetDeviceTypes = new List<DeviceType>();
projectConfig.targetDeviceTypes.Add(DeviceType.Quest);
projectConfig.targetDeviceTypes.Add(DeviceType.Quest2);
projectConfig.allowOptional3DofHeadTracking = false;
projectConfig.handTrackingSupport = HandTrackingSupport.ControllersOnly;
projectConfig.handTrackingFrequency = HandTrackingFrequency.LOW;
projectConfig.handTrackingVersion = HandTrackingVersion.Default;
projectConfig.anchorSupport = AnchorSupport.Disabled;
projectConfig.trackedKeyboardSupport = TrackedKeyboardSupport.None;
projectConfig.renderModelSupport = RenderModelSupport.Disabled;
projectConfig.disableBackups = true;
projectConfig.enableNSCConfig = true;
projectConfig.skipUnneededShaders = false;
projectConfig.requiresSystemKeyboard = false;
projectConfig.experimentalFeaturesEnabled = false;
projectConfig.insightPassthroughEnabled = false;
AssetDatabase.CreateAsset(projectConfig, oculusProjectConfigAssetPath);
}
// Force migration to Quest device if still on legacy GearVR/Go device type
if (projectConfig.targetDeviceTypes.Contains((DeviceType)0)) // deprecated GearVR/Go device
{
projectConfig.targetDeviceTypes.Remove((DeviceType)0); // deprecated GearVR/Go device
if (!projectConfig.targetDeviceTypes.Contains(DeviceType.Quest))
{
projectConfig.targetDeviceTypes.Add(DeviceType.Quest);
}
if (!projectConfig.targetDeviceTypes.Contains(DeviceType.Quest2))
{
projectConfig.targetDeviceTypes.Add(DeviceType.Quest2);
}
}
return projectConfig;
}
public static void CommitProjectConfig(OVRProjectConfig projectConfig)
{
string oculusProjectConfigAssetPath = GetOculusProjectConfigAssetPath();
if (AssetDatabase.GetAssetPath(projectConfig) != oculusProjectConfigAssetPath)
{
Debug.LogWarningFormat("The asset path of ProjectConfig is wrong. Expect {0}, get {1}", oculusProjectConfigAssetPath, AssetDatabase.GetAssetPath(projectConfig));
}
EditorUtility.SetDirty(projectConfig);
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 05d394ae2a81edd4cbc3c51917e766e3
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,215 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* Licensed under the Oculus SDK License Agreement (the "License");
* you may not use the Oculus SDK except in compliance with the License,
* which is provided at the time of installation or download, or which
* otherwise accompanies this software in either electronic or hard copy form.
*
* You may obtain a copy of the License at
*
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Oculus SDK
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using UnityEngine;
using UnityEditor;
using System.IO;
/// <summary>
/// From the selected transform, takes a cubemap screenshot that can be submitted with the application
/// as a screenshot (or additionally used for reflection shaders).
/// </summary>
class OVRScreenshotWizard : ScriptableWizard
{
public enum TexFormat
{
JPEG, // 512kb at 1k x 1k resolution vs
PNG, // 5.3mb
}
public enum SaveMode {
SaveCubemapScreenshot,
SaveUnityCubemap,
SaveBoth,
}
public GameObject renderFrom = null;
public int size = 2048;
public SaveMode saveMode = SaveMode.SaveUnityCubemap;
public string cubeMapFolder = "Assets/Textures/Cubemaps";
public TexFormat textureFormat = TexFormat.PNG;
/// <summary>
/// Validates the user's input
/// </summary>
void OnWizardUpdate()
{
helpString = "Select a game object positioned in the place where\nyou want to render the cubemap screenshot from: ";
isValid = (renderFrom != null);
}
/// <summary>
/// Create the asset path if it is not available.
/// Assuming the newFolderPath is stated with "Assets", which is a requirement.
/// </summary>
static bool CreateAssetPath( string newFolderPath )
{
const int maxFoldersCount = 32;
string currentPath;
string[] pathFolders;
pathFolders = newFolderPath.Split (new char[]{ '/' }, maxFoldersCount);
if (!string.Equals ("Assets", pathFolders [0], System.StringComparison.OrdinalIgnoreCase))
{
Debug.LogError( "Folder path has to be started with \" Assets \" " );
return false;
}
currentPath = "Assets";
for (int i = 1; i < pathFolders.Length; i++)
{
if (!string.IsNullOrEmpty(pathFolders[i]))
{
string newPath = currentPath + "/" + pathFolders[i];
if (!AssetDatabase.IsValidFolder(newPath))
AssetDatabase.CreateFolder(currentPath, pathFolders[i]);
currentPath = newPath;
}
}
Debug.Log( "Created path: " + currentPath );
return true;
}
/// <summary>
/// Renders the cubemap
/// </summary>
void OnWizardCreate()
{
if ( !AssetDatabase.IsValidFolder( cubeMapFolder ) )
{
if (!CreateAssetPath(cubeMapFolder))
{
Debug.LogError( "Created path failed: " + cubeMapFolder );
return;
}
}
bool existingCamera = true;
bool existingCameraStateSave = true;
Camera camera = renderFrom.GetComponent<Camera>();
if (camera == null)
{
camera = renderFrom.AddComponent<Camera>();
camera.farClipPlane = 10000f;
existingCamera = false;
}
else
{
existingCameraStateSave = camera.enabled;
camera.enabled = true;
}
// find the last screenshot saved
if (cubeMapFolder[cubeMapFolder.Length-1] != '/')
{
cubeMapFolder += "/";
}
int idx = 0;
string[] fileNames = Directory.GetFiles(cubeMapFolder);
foreach(string fileName in fileNames)
{
if (!fileName.ToLower().EndsWith(".cubemap"))
{
continue;
}
string temp = fileName.Replace(cubeMapFolder + "vr_screenshot_", string.Empty);
temp = temp.Replace(".cubemap", string.Empty);
int tempIdx = 0;
if (int.TryParse( temp, out tempIdx ))
{
if (tempIdx > idx)
{
idx = tempIdx;
}
}
}
string pathName = string.Format("{0}vr_screenshot_{1}.cubemap", cubeMapFolder, (++idx).ToString("d2"));
Cubemap cubemap = new Cubemap(size, TextureFormat.RGB24, false);
// render into cubemap
if ((camera != null) && (cubemap != null))
{
// set up cubemap defaults
OVRCubemapCapture.RenderIntoCubemap(camera, cubemap);
if (existingCamera)
{
camera.enabled = existingCameraStateSave;
}
else
{
DestroyImmediate(camera);
}
// generate a regular texture as well?
if ( ( saveMode == SaveMode.SaveCubemapScreenshot ) || ( saveMode == SaveMode.SaveBoth ) )
{
GenerateTexture(cubemap, pathName);
}
if ( ( saveMode == SaveMode.SaveUnityCubemap ) || ( saveMode == SaveMode.SaveBoth ) )
{
Debug.Log( "Saving: " + pathName );
// by default the unity cubemap isn't saved
AssetDatabase.CreateAsset( cubemap, pathName );
// reimport as necessary
AssetDatabase.SaveAssets();
// select it in the project tree so developers can find it
EditorGUIUtility.PingObject( cubemap );
Selection.activeObject = cubemap;
}
AssetDatabase.Refresh();
}
}
/// <summary>
/// Generates a NPOT 6x1 cubemap in the following format PX NX PY NY PZ NZ
/// </summary>
void GenerateTexture(Cubemap cubemap, string pathName)
{
// Encode the texture and save it to disk
pathName = pathName.Replace(".cubemap", (textureFormat == TexFormat.PNG) ? ".png" : ".jpg" ).ToLower();
pathName = pathName.Replace( cubeMapFolder.ToLower(), "" );
string format = textureFormat.ToString();
string fullPath = EditorUtility.SaveFilePanel( string.Format( "Save Cubemap Screenshot as {0}", format ), "", pathName, format.ToLower() );
if ( !string.IsNullOrEmpty( fullPath ) )
{
Debug.Log( "Saving: " + fullPath );
OVRCubemapCapture.SaveCubemapCapture(cubemap, fullPath);
}
}
/// <summary>
/// Unity Editor menu option to take a screenshot
/// </summary>
[MenuItem("Oculus/Tools/OVR Screenshot Wizard", false, 100000)]
static void TakeOVRScreenshot()
{
OVRScreenshotWizard wizard = ScriptableWizard.DisplayWizard<OVRScreenshotWizard>("OVR Screenshot Wizard", "Render Cubemap");
if (wizard != null)
{
if (Selection.activeGameObject != null)
wizard.renderFrom = Selection.activeGameObject;
else
wizard.renderFrom = Camera.main.gameObject;
wizard.isValid = (wizard.renderFrom != null);
}
}
}

View File

@ -1,13 +0,0 @@
fileFormatVersion: 2
guid: b8b9ee1d7b188284f90d944cd54eb026
timeCreated: 1462825988
licenseType: Store
MonoImporter:
serializedVersion: 2
defaultReferences:
- renderFrom: {fileID: 168286, guid: a5014611cefbb6b4398b7e4c82203d08, type: 2}
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,74 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* Licensed under the Oculus SDK License Agreement (the "License");
* you may not use the Oculus SDK except in compliance with the License,
* which is provided at the time of installation or download, or which
* otherwise accompanies this software in either electronic or hard copy form.
*
* You may obtain a copy of the License at
*
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Oculus SDK
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System.Collections.Generic;
using UnityEditor;
using UnityEditor.Build;
using UnityEditor.Rendering;
using UnityEngine;
using UnityEngine.Rendering;
public class OVRShaderBuildProcessor : IPreprocessShaders
{
public int callbackOrder { get { return 0; } }
public void OnProcessShader(
Shader shader, ShaderSnippetData snippet, IList<ShaderCompilerData> shaderCompilerData)
{
var projectConfig = OVRProjectConfig.GetProjectConfig();
if (projectConfig == null)
{
return;
}
if (!projectConfig.skipUnneededShaders)
{
return;
}
if (EditorUserBuildSettings.activeBuildTarget != BuildTarget.Android)
{
return;
}
var strippedGraphicsTiers = new HashSet<GraphicsTier>();
// Unity only uses shader Tier2 on Quest and Go (regardless of graphics API)
if (projectConfig.targetDeviceTypes.Contains(OVRProjectConfig.DeviceType.Quest) ||
projectConfig.targetDeviceTypes.Contains(OVRProjectConfig.DeviceType.Quest2))
{
strippedGraphicsTiers.Add(GraphicsTier.Tier1);
strippedGraphicsTiers.Add(GraphicsTier.Tier3);
}
if (strippedGraphicsTiers.Count == 0)
{
return;
}
for (int i = shaderCompilerData.Count - 1; i >= 0; --i)
{
if (strippedGraphicsTiers.Contains(shaderCompilerData[i].graphicsTier))
{
shaderCompilerData.RemoveAt(i);
}
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: cb08fbbe69f983b4dbac5e1b413fea34
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,735 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* Licensed under the Oculus SDK License Agreement (the "License");
* you may not use the Oculus SDK except in compliance with the License,
* which is provided at the time of installation or download, or which
* otherwise accompanies this software in either electronic or hard copy form.
*
* You may obtain a copy of the License at
*
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Oculus SDK
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System.Collections.Generic;
using System;
using System.Reflection;
using UnityEngine;
using UnityEditor;
using System.Text;
using System.IO;
public class OVRSystemProfilerPanel : EditorWindow {
[MenuItem("Oculus/Tools/(Deprecated) Oculus Profiler Panel", false, 200000)]
public static void ShowWindow()
{
EditorWindow.GetWindow(typeof(OVRSystemProfilerPanel), false, "Oculus Profiler");
OVRPlugin.SendEvent("oculus_profiler_panel", "show_window");
}
bool showAndroidOptions = false;
OVRNetwork.OVRNetworkTcpClient tcpClient = new OVRNetwork.OVRNetworkTcpClient();
int remoteListeningPort = OVRSystemPerfMetrics.TcpListeningPort;
//OVRSystemPerfMetrics.PerfMetrics lastReceivedMetrics;
const int maxMetricsFrames = 120;
const float metricsHistoryDuration = 1.0f;
List<OVRSystemPerfMetrics.PerfMetrics> receivedMetricsList = new List<OVRSystemPerfMetrics.PerfMetrics>();
bool pauseReceiveMetrics = false;
bool repaintRequested = false;
const float labelWidth = 140.0f;
const float panelInnerRightPad = 6.0f;
const float progressBarPad = 5.0f;
const float progressBarHeight = 18.0f;
string androidSdkRootPath;
OVRADBTool adbTool;
private static GUIStyle odhCalloutBackgroundStyle;
private static GUIStyle odhCalloutTextStyle;
// The actual window code goes here
void OnGUI()
{
if (odhCalloutBackgroundStyle == null)
{
odhCalloutBackgroundStyle = new GUIStyle(EditorStyles.helpBox);
var odhCalloutBackgroundStyleTex = new Texture2D(1, 1);
odhCalloutBackgroundStyleTex.SetPixel(0, 0, new Color(0.9f, 0.8f, 0.2f, 0.2f));
odhCalloutBackgroundStyleTex.Apply();
odhCalloutBackgroundStyle.normal.background = odhCalloutBackgroundStyleTex;
}
if (odhCalloutTextStyle == null)
{
odhCalloutTextStyle = new GUIStyle(EditorStyles.label);
odhCalloutTextStyle.richText = true;
odhCalloutTextStyle.wordWrap = true;
}
// ODH Callout Section
GUILayout.BeginHorizontal(odhCalloutBackgroundStyle);
var script = MonoScript.FromScriptableObject(this);
string assetPath = AssetDatabase.GetAssetPath(script);
string editorPath = Path.GetDirectoryName(assetPath);
string odhIconPath = Path.Combine(editorPath, "Textures\\odh_icon.png");
Texture ODHIcon = (Texture)EditorGUIUtility.Load(odhIconPath);
GUILayout.Box(ODHIcon, GUILayout.Width(60.0f), GUILayout.Height(60.0f));
GUILayout.BeginVertical();
EditorGUILayout.LabelField("<b>This tool is deprecated.</b> Oculus recommends profiling builds through the Metrics section of "
+ "<b>Oculus Developer Hub</b>, a desktop companion tool that streamlines the Quest development workflow.",
odhCalloutTextStyle);
GUIContent ODHLabel = new GUIContent("Download Oculus Developer Hub");
#if UNITY_2021_1_OR_NEWER
if (EditorGUILayout.LinkButton(ODHLabel))
#else
if (GUILayout.Button(ODHLabel, GUILayout.ExpandWidth(false)))
#endif
{
#if UNITY_EDITOR_WIN
Application.OpenURL("https://developer.oculus.com/downloads/package/oculus-developer-hub-win/?source=unity");
#elif UNITY_EDITOR_OSX
Application.OpenURL("https://developer.oculus.com/downloads/package/oculus-developer-hub-mac/?source=unity");
#endif
}
GUILayout.EndVertical();
GUILayout.EndHorizontal();
GUILayout.Space(15.0f);
showAndroidOptions = EditorGUILayout.Foldout(showAndroidOptions, "Android Tools");
if (showAndroidOptions)
{
GUILayout.BeginHorizontal();
EditorGUILayout.LabelField("Android SDK root path: ", androidSdkRootPath);
GUILayout.EndHorizontal();
GUILayout.BeginHorizontal();
if (GUILayout.Button("Start Server"))
{
if (adbTool == null)
{
adbTool = new OVRADBTool(androidSdkRootPath);
}
if (adbTool.isReady)
{
int exitCode = adbTool.StartServer(null);
EditorUtility.DisplayDialog("ADB StartServer", (exitCode == 0 ? "Success" : "Failure. ExitCode = " + exitCode.ToString()), "Ok");
}
else
{
EditorUtility.DisplayDialog("Can't locate ADBTool", adbTool.adbPath, "Ok");
}
}
if (GUILayout.Button("Kill Server"))
{
if (adbTool == null)
{
adbTool = new OVRADBTool(androidSdkRootPath);
}
if (adbTool.isReady)
{
int exitCode = adbTool.KillServer(null);
EditorUtility.DisplayDialog("ADB KillServer", (exitCode == 0 ? "Success" : "Failure. ExitCode = " + exitCode.ToString()), "Ok");
}
else
{
EditorUtility.DisplayDialog("Can't locate ADBTool", adbTool.adbPath, "Ok");
}
}
if (GUILayout.Button("Forward Port"))
{
if (adbTool == null)
{
adbTool = new OVRADBTool(androidSdkRootPath);
}
if (adbTool.isReady)
{
int exitCode = adbTool.ForwardPort(remoteListeningPort, null);
EditorUtility.DisplayDialog("ADB ForwardPort", (exitCode == 0 ? "Success" : "Failure. ExitCode = " + exitCode.ToString()), "Ok");
OVRPlugin.SendEvent("device_metrics_profiler", (exitCode == 0 ? "adb_forward_success" : "adb_forward_failure"));
}
else
{
EditorUtility.DisplayDialog("Can't locate ADBTool", adbTool.adbPath, "Ok");
}
}
if (GUILayout.Button("Release Port"))
{
if (adbTool == null)
{
adbTool = new OVRADBTool(androidSdkRootPath);
}
if (adbTool.isReady)
{
int exitCode = adbTool.ReleasePort(remoteListeningPort, null);
EditorUtility.DisplayDialog("ADB ReleasePort", (exitCode == 0 ? "Success" : "Failure. ExitCode = " + exitCode.ToString()), "Ok");
}
else
{
EditorUtility.DisplayDialog("Can't locate ADBTool", adbTool.adbPath, "Ok");
}
}
GUILayout.EndHorizontal();
}
EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
GUILayout.BeginHorizontal();
remoteListeningPort = EditorGUILayout.DelayedIntField("Remote Port", remoteListeningPort);
if (tcpClient.connectionState == OVRNetwork.OVRNetworkTcpClient.ConnectionState.Disconnected)
{
if (GUILayout.Button("Connect"))
{
ConnectPerfMetricsTcpServer();
pauseReceiveMetrics = false;
OVRPlugin.SendEvent("device_metrics_profiler", "connect");
}
}
else
{
if (tcpClient.connectionState == OVRNetwork.OVRNetworkTcpClient.ConnectionState.Connecting)
{
if (GUILayout.Button("Connecting ... Click again to Cancel"))
{
DisconnectPerfMetricsTcpServer();
OVRPlugin.SendEvent("device_metrics_profiler", "cancel");
}
}
else
{
if (GUILayout.Button("Disconnect"))
{
DisconnectPerfMetricsTcpServer();
OVRPlugin.SendEvent("device_metrics_profiler", "disconnect");
}
if (GUILayout.Button(pauseReceiveMetrics ? "Continue" : "Pause"))
{
pauseReceiveMetrics = !pauseReceiveMetrics;
}
}
}
GUILayout.EndHorizontal();
EditorGUILayout.LabelField("", GUI.skin.horizontalSlider);
lock (receivedMetricsList)
{
PresentIntProperty("Frame Count", "frameCount");
PresentIntProperty("Dropped Frame Count", "compositorDroppedFrameCount");
float? avgFrameTime = GetAveragePerfValueFloat("deltaFrameTime");
if (avgFrameTime.HasValue)
{
float fps = 1.0f / avgFrameTime.Value;
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("FPS", GUILayout.Width(labelWidth));
EditorGUILayout.LabelField(string.Format("{0:F1}", fps));
EditorGUILayout.EndHorizontal();
}
int? deviceCpuClockLevel = GetLatestPerfValueInt("deviceCpuClockLevel");
int? deviceGpuClockLevel = GetLatestPerfValueInt("deviceGpuClockLevel");
float? deviceCpuClockFrequencyInMHz = GetLatestPerfValueFloat("deviceCpuClockFrequencyInMHz");
float? deviceGpuClockFrequencyInMHz = GetLatestPerfValueFloat("deviceGpuClockFrequencyInMHz");
if (deviceCpuClockLevel.HasValue || deviceCpuClockFrequencyInMHz.HasValue)
{
string cpuLabel;
string cpuText;
if (deviceCpuClockLevel.HasValue && deviceCpuClockFrequencyInMHz.HasValue)
{
cpuLabel = "CPU Level (Freq)";
cpuText = string.Format("{0} ({1:F0} MHz)", deviceCpuClockLevel, deviceCpuClockFrequencyInMHz);
}
else if (deviceCpuClockLevel.HasValue)
{
cpuLabel = "CPU Level";
cpuText = string.Format("{0}", deviceCpuClockLevel);
}
else
{
cpuLabel = "CPU Frequency";
cpuText = string.Format("{0:F0} MHz", deviceCpuClockFrequencyInMHz);
}
PresentText(cpuLabel, cpuText);
}
if (deviceGpuClockLevel.HasValue || deviceGpuClockFrequencyInMHz.HasValue)
{
string cpuLabel;
string cpuText;
if (deviceGpuClockLevel.HasValue && deviceGpuClockFrequencyInMHz.HasValue)
{
cpuLabel = "GPU Level (Freq)";
cpuText = string.Format("{0} ({1:F0} MHz)", deviceGpuClockLevel, deviceGpuClockFrequencyInMHz);
}
else if (deviceGpuClockLevel.HasValue)
{
cpuLabel = "GPU Level";
cpuText = string.Format("{0}", deviceGpuClockLevel);
}
else
{
cpuLabel = "GPU Frequency";
cpuText = string.Format("{0:F0} MHz", deviceGpuClockFrequencyInMHz);
}
PresentText(cpuLabel, cpuText);
}
PresentColumnTitles("Current", "Average", "Peak");
PresentFloatTimeInMs("Frame Time", "deltaFrameTime", 0.020f, true, true);
PresentFloatTimeInMs("App CPU Time", "appCpuTime", 0.020f, true, true);
PresentFloatTimeInMs("App GPU Time", "appGpuTime", 0.020f, true, true);
PresentFloatTimeInMs("Compositor CPU Time", "compositorCpuTime", 0.020f, true, true);
PresentFloatTimeInMs("Compositor GPU Time", "compositorGpuTime", 0.020f, true, true);
PresentFloatPercentage("CPU Util (Average)", "systemCpuUtilAveragePercentage", false, false);
PresentFloatPercentage("CPU Util (Worst Core)", "systemCpuUtilWorstPercentage", false, false);
PresentFloatPercentage("GPU Util", "systemGpuUtilPercentage", false, false);
}
}
void GetMetricsField(string propertyName, out FieldInfo baseFieldInfo, out FieldInfo validalityFieldInfo)
{
baseFieldInfo = typeof(OVRSystemPerfMetrics.PerfMetrics).GetField(propertyName);
validalityFieldInfo = typeof(OVRSystemPerfMetrics.PerfMetrics).GetField(propertyName + "_IsValid");
}
bool HasValidPerfMetrics(string propertyName)
{
FieldInfo baseFieldInfo, validalityFieldInfo;
GetMetricsField(propertyName, out baseFieldInfo, out validalityFieldInfo);
if (baseFieldInfo == null || (validalityFieldInfo != null && validalityFieldInfo.FieldType != typeof(bool)))
{
Debug.LogWarning("[OVRSystemProfilerPanel] Unable to find property " + propertyName);
return false;
}
if (validalityFieldInfo == null)
{
return true;
}
for (int i = receivedMetricsList.Count - 1; i >= 0; --i)
{
var metrics = receivedMetricsList[i];
if (validalityFieldInfo != null && (bool)validalityFieldInfo.GetValue(metrics))
{
return true;
}
}
return false;
}
int? GetLatestPerfValueInt(string propertyName)
{
FieldInfo baseFieldInfo, validalityFieldInfo;
GetMetricsField(propertyName, out baseFieldInfo, out validalityFieldInfo);
if (baseFieldInfo == null || baseFieldInfo.FieldType != typeof(int) ||
(validalityFieldInfo != null && validalityFieldInfo.FieldType != typeof(bool)))
{
Debug.LogWarning("[OVRSystemProfilerPanel] GetLatestPerfValueInt(): Type mismatch");
return null;
}
if (receivedMetricsList.Count == 0)
{
return null;
}
for (int i = receivedMetricsList.Count - 1; i >= 0; --i)
{
var metrics = receivedMetricsList[i];
if (validalityFieldInfo == null || (validalityFieldInfo != null && (bool)validalityFieldInfo.GetValue(metrics)))
{
return (int)baseFieldInfo.GetValue(metrics);
}
}
return null;
}
float? GetLatestPerfValueFloat(string propertyName)
{
FieldInfo baseFieldInfo, validalityFieldInfo;
GetMetricsField(propertyName, out baseFieldInfo, out validalityFieldInfo);
if (baseFieldInfo == null || baseFieldInfo.FieldType != typeof(float) ||
(validalityFieldInfo != null && validalityFieldInfo.FieldType != typeof(bool)))
{
Debug.LogWarning("[OVRSystemProfilerPanel] GetLatestPerfValueFloat(): Type mismatch");
return null;
}
if (receivedMetricsList.Count == 0)
{
return null;
}
for (int i = receivedMetricsList.Count - 1; i >= 0; --i)
{
var metrics = receivedMetricsList[i];
if (validalityFieldInfo == null || (validalityFieldInfo != null && (bool)validalityFieldInfo.GetValue(metrics)))
{
return (float)baseFieldInfo.GetValue(metrics);
}
}
return null;
}
float? GetAveragePerfValueFloat(string propertyName)
{
FieldInfo baseFieldInfo, validalityFieldInfo;
GetMetricsField(propertyName, out baseFieldInfo, out validalityFieldInfo);
if (baseFieldInfo == null || baseFieldInfo.FieldType != typeof(float) ||
(validalityFieldInfo != null && validalityFieldInfo.FieldType != typeof(bool)))
{
Debug.LogWarning("[OVRSystemProfilerPanel] GetAveragePerfValueFloat(): Type mismatch");
return null;
}
int count = 0;
float sum = 0;
OVRSystemPerfMetrics.PerfMetrics lastMetrics = null;
int metricsIndex;
for (metricsIndex = receivedMetricsList.Count - 1; metricsIndex >= 0; --metricsIndex)
{
var metrics = receivedMetricsList[metricsIndex];
if (validalityFieldInfo != null && !(bool)validalityFieldInfo.GetValue(metrics))
{
continue;
}
lastMetrics = metrics;
break;
}
if (lastMetrics == null)
{
return null;
}
for (; metricsIndex >=0; -- metricsIndex)
{
var metrics = receivedMetricsList[metricsIndex];
if (metrics.frameTime < lastMetrics.frameTime - metricsHistoryDuration)
{
break;
}
if (validalityFieldInfo != null && !(bool)validalityFieldInfo.GetValue(metrics))
{
continue;
}
sum += (float)baseFieldInfo.GetValue(metrics);
count++;
}
if (count == 0)
{
return null;
}
else
{
return sum / count;
}
}
float? GetMaxPerfValueFloat(string propertyName)
{
FieldInfo baseFieldInfo, validalityFieldInfo;
GetMetricsField(propertyName, out baseFieldInfo, out validalityFieldInfo);
if (baseFieldInfo == null || baseFieldInfo.FieldType != typeof(float) ||
(validalityFieldInfo != null && validalityFieldInfo.FieldType != typeof(bool)))
{
Debug.LogWarning("[OVRSystemProfilerPanel] GetMaxPerfValueFloat(): Type mismatch");
return null;
}
OVRSystemPerfMetrics.PerfMetrics lastMetrics = null;
int metricsIndex;
for (metricsIndex = receivedMetricsList.Count - 1; metricsIndex >= 0; --metricsIndex)
{
var metrics = receivedMetricsList[metricsIndex];
if (validalityFieldInfo != null && !(bool)validalityFieldInfo.GetValue(metrics))
{
continue;
}
lastMetrics = metrics;
break;
}
if (lastMetrics == null)
{
return null;
}
float? result = null;
for (; metricsIndex >= 0; --metricsIndex)
{
var metrics = receivedMetricsList[metricsIndex];
if (metrics.frameTime < lastMetrics.frameTime - metricsHistoryDuration)
{
break;
}
if (validalityFieldInfo != null && !(bool)validalityFieldInfo.GetValue(metrics))
{
continue;
}
else
{
float value = (float)baseFieldInfo.GetValue(metrics);
if (!result.HasValue || result.Value < value)
{
result = value;
}
}
}
return result;
}
void PresentFloatPercentage(string label, string propertyName, bool displayAverage, bool displayMaximum)
{
float? lastValue = GetLatestPerfValueFloat(propertyName);
if (!lastValue.HasValue)
{
return;
}
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(label, GUILayout.Width(labelWidth));
Rect r = EditorGUILayout.BeginVertical();
float barWidth = (r.width - panelInnerRightPad - progressBarPad * 2) / 3.0f;
EditorGUI.ProgressBar(new Rect(r.x, r.y, barWidth, r.height), lastValue.Value, string.Format("{0:F1}%", lastValue.Value * 100.0f));
if (displayAverage)
{
float? averageValue = GetAveragePerfValueFloat(propertyName);
if (averageValue.HasValue)
{
EditorGUI.ProgressBar(new Rect(r.x + barWidth + progressBarPad, r.y, barWidth, r.height), averageValue.Value, string.Format("{0:F1}%", averageValue.Value * 100.0f));
}
}
if (displayMaximum)
{
float? maxValue = GetMaxPerfValueFloat(propertyName);
if (maxValue.HasValue)
{
EditorGUI.ProgressBar(new Rect(r.x + (barWidth + progressBarPad) * 2, r.y, barWidth, r.height), maxValue.Value, string.Format("{0:F1}%", maxValue.Value * 100.0f));
}
}
GUILayout.Space(progressBarHeight);
EditorGUILayout.EndVertical();
EditorGUILayout.EndHorizontal();
}
void PresentFloatTimeInMs(string label, string propertyName, float maxScale, bool displayAverage, bool displayMaximum)
{
float? lastValue = GetLatestPerfValueFloat(propertyName);
if (!lastValue.HasValue)
{
return;
}
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(label, GUILayout.Width(labelWidth));
Rect r = EditorGUILayout.BeginVertical();
float barWidth = (r.width - panelInnerRightPad - progressBarPad * 2) / 3.0f;
EditorGUI.ProgressBar(new Rect(r.x, r.y, barWidth, r.height), lastValue.Value/maxScale, string.Format("{0:F1} ms", lastValue.Value * 1000.0f));
if (displayAverage)
{
float? averageValue = GetAveragePerfValueFloat(propertyName);
if (averageValue.HasValue)
{
EditorGUI.ProgressBar(new Rect(r.x + barWidth + progressBarPad, r.y, barWidth, r.height), averageValue.Value / maxScale, string.Format("{0:F1} ms", averageValue.Value * 1000.0f));
}
}
if (displayMaximum)
{
float? maxValue = GetMaxPerfValueFloat(propertyName);
if (maxValue.HasValue)
{
EditorGUI.ProgressBar(new Rect(r.x + (barWidth + progressBarPad) * 2, r.y, barWidth, r.height), maxValue.Value / maxScale, string.Format("{0:F1} ms", maxValue.Value * 1000.0f));
}
}
GUILayout.Space(progressBarHeight);
EditorGUILayout.EndVertical();
EditorGUILayout.EndHorizontal();
}
void PresentIntProperty(string label, string propertyName)
{
int? lastValue = GetLatestPerfValueInt(propertyName);
if (!lastValue.HasValue)
{
return;
}
PresentText(label, lastValue.Value.ToString());
}
void PresentText(string label, string text)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField(label, GUILayout.Width(labelWidth));
EditorGUILayout.LabelField(text);
EditorGUILayout.EndHorizontal();
}
void PresentColumnTitles(string title0, string title1, string title2)
{
EditorGUILayout.BeginHorizontal();
EditorGUILayout.LabelField("", GUILayout.Width(labelWidth));
float windowWidth = position.width;
float barWidth = (windowWidth - labelWidth - panelInnerRightPad * 3 ) / 3.0f;
EditorGUILayout.LabelField(title0, GUILayout.Width(barWidth));
EditorGUILayout.LabelField(title1, GUILayout.Width(barWidth));
EditorGUILayout.LabelField(title2, GUILayout.Width(barWidth));
EditorGUILayout.EndHorizontal();
}
// Called as the new window is opened.
private void Awake()
{
InitializeAndroidSdkPath();
minSize = new Vector2(400, 300);
}
void InitializeAndroidSdkPath()
{
androidSdkRootPath = OVRConfig.Instance.GetAndroidSDKPath();
}
// OnDestroy is called to close the EditorWindow window.
private void OnDestroy()
{
DisconnectPerfMetricsTcpServer();
}
// Called multiple times per second on all visible windows.
private void Update()
{
if (tcpClient != null && tcpClient.Connected)
{
tcpClient.Tick();
}
if (repaintRequested)
{
Repaint();
repaintRequested = false;
}
}
void OnConnectionStateChanged()
{
repaintRequested = true;
if (tcpClient.connectionState == OVRNetwork.OVRNetworkTcpClient.ConnectionState.Disconnected)
{
tcpClient.connectionStateChangedCallback -= OnConnectionStateChanged;
tcpClient.payloadReceivedCallback -= OnPayloadReceived;
}
}
void OnPayloadReceived(int payloadType, byte[] buffer, int start, int length)
{
if (payloadType == OVRSystemPerfMetrics.PayloadTypeMetrics)
{
string message = Encoding.UTF8.GetString(buffer, start, length);
OnMessageReceived(message);
}
else
{
Debug.LogWarningFormat("[OVRSystemProfilerPanel] unrecongized payload type {0}", payloadType);
}
}
void OnMessageReceived(string message)
{
if (pauseReceiveMetrics)
{
return;
}
var metrics = new OVRSystemPerfMetrics.PerfMetrics();
if (!metrics.LoadFromJSON(message))
{
Debug.LogWarning("Cannot analyze metrics: " + message);
return;
}
lock(receivedMetricsList)
{
if (receivedMetricsList.Count >= maxMetricsFrames)
{
receivedMetricsList.RemoveAt(0);
}
receivedMetricsList.Add(metrics);
}
repaintRequested = true;
}
void ConnectPerfMetricsTcpServer()
{
tcpClient.connectionStateChangedCallback += OnConnectionStateChanged;
tcpClient.payloadReceivedCallback += OnPayloadReceived;
tcpClient.Connect(remoteListeningPort);
EditorApplication.playModeStateChanged += OnApplicationPlayModeStateChanged;
}
void DisconnectPerfMetricsTcpServer()
{
EditorApplication.playModeStateChanged -= OnApplicationPlayModeStateChanged;
tcpClient.Disconnect();
}
void OnApplicationPlayModeStateChanged(PlayModeStateChange change)
{
Debug.LogFormat("[OVRSystemPerfMetricsWindow] OnApplicationPlayModeStateChanged {0}", change.ToString());
if (change == PlayModeStateChange.ExitingPlayMode)
{
tcpClient.Disconnect();
}
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 60f797c78d731a54e9d4a949cfa2f989
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,47 +0,0 @@
{
"name": "Oculus.VR.Editor",
"rootNamespace": "",
"references": [
"Oculus.VR",
"Unity.XR.Oculus",
"Unity.XR.OpenXR",
"Unity.XR.OpenXR.Editor"
],
"includePlatforms": [
"Editor"
],
"excludePlatforms": [],
"allowUnsafeCode": false,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": [],
"versionDefines": [
{
"name": "com.unity.xr.management",
"expression": "",
"define": "USING_XR_MANAGEMENT"
},
{
"name": "com.unity.xr.oculus",
"expression": "",
"define": "USING_XR_SDK_OCULUS"
},
{
"name": "com.unity.xr.openxr",
"expression": "",
"define": "USING_XR_SDK_OPENXR"
},
{
"name": "com.unity.xr.oculus",
"expression": "1.4.0",
"define": "USING_COMPATIBLE_OCULUS_XR_PLUGIN_VERSION"
},
{
"name": "com.unity.xr.oculus",
"expression": "1.7.0",
"define": "PRIORITIZE_OCULUS_XR_SETTINGS"
}
],
"noEngineReferences": false
}

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: d2761a0af0f567748a72629d4bb18a26
AssemblyDefinitionImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,46 +0,0 @@
/*
* Copyright (c) Meta Platforms, Inc. and affiliates.
* All rights reserved.
*
* Licensed under the Oculus SDK License Agreement (the "License");
* you may not use the Oculus SDK except in compliance with the License,
* which is provided at the time of installation or download, or which
* otherwise accompanies this software in either electronic or hard copy form.
*
* You may obtain a copy of the License at
*
* https://developer.oculus.com/licenses/oculussdk/
*
* Unless required by applicable law or agreed to in writing, the Oculus SDK
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
using System;
using System.IO;
public static class PathHelper
{
public static string MakeRelativePath(string fromPath, string toPath)
{
var fromUri = new Uri(Path.GetFullPath(fromPath));
var toUri = new Uri(Path.GetFullPath(toPath));
if (fromUri.Scheme != toUri.Scheme)
{
return toPath;
}
var relativeUri = fromUri.MakeRelativeUri(toUri);
var relativePath = Uri.UnescapeDataString(relativeUri.ToString());
if (toUri.Scheme.Equals("file", StringComparison.InvariantCultureIgnoreCase))
{
relativePath = relativePath.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
}
return relativePath;
}
}

View File

@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: e97d8d54c1d1f16468e12a2079fdd060
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: f177e155338d57548977e581b2950d6a
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,671 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!29 &1
OcclusionCullingSettings:
m_ObjectHideFlags: 0
serializedVersion: 2
m_OcclusionBakeSettings:
smallestOccluder: 5
smallestHole: 0.25
backfaceThreshold: 100
m_SceneGUID: 00000000000000000000000000000000
m_OcclusionCullingData: {fileID: 0}
--- !u!104 &2
RenderSettings:
m_ObjectHideFlags: 0
serializedVersion: 8
m_Fog: 0
m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
m_FogMode: 3
m_FogDensity: 0.01
m_LinearFogStart: 0
m_LinearFogEnd: 300
m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
m_AmbientIntensity: 1
m_AmbientMode: 0
m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
m_HaloStrength: 0.5
m_FlareStrength: 1
m_FlareFadeSpeed: 3
m_HaloTexture: {fileID: 0}
m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
m_DefaultReflectionMode: 0
m_DefaultReflectionResolution: 128
m_ReflectionBounces: 1
m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 0}
m_IndirectSpecularColor: {r: 0, g: 0, b: 0, a: 1}
--- !u!157 &3
LightmapSettings:
m_ObjectHideFlags: 0
serializedVersion: 11
m_GIWorkflowMode: 1
m_GISettings:
serializedVersion: 2
m_BounceScale: 1
m_IndirectOutputScale: 1
m_AlbedoBoost: 1
m_TemporalCoherenceThreshold: 1
m_EnvironmentLightingMode: 0
m_EnableBakedLightmaps: 1
m_EnableRealtimeLightmaps: 1
m_LightmapEditorSettings:
serializedVersion: 9
m_Resolution: 2
m_BakeResolution: 40
m_TextureWidth: 1024
m_TextureHeight: 1024
m_AO: 0
m_AOMaxDistance: 1
m_CompAOExponent: 1
m_CompAOExponentDirect: 0
m_Padding: 2
m_LightmapParameters: {fileID: 0}
m_LightmapsBakeMode: 1
m_TextureCompression: 1
m_FinalGather: 0
m_FinalGatherFiltering: 1
m_FinalGatherRayCount: 256
m_ReflectionCompression: 2
m_MixedBakeMode: 2
m_BakeBackend: 1
m_PVRSampling: 1
m_PVRDirectSampleCount: 32
m_PVRSampleCount: 512
m_PVRBounces: 2
m_PVRFilterTypeDirect: 0
m_PVRFilterTypeIndirect: 0
m_PVRFilterTypeAO: 0
m_PVRFilteringMode: 1
m_PVRCulling: 1
m_PVRFilteringGaussRadiusDirect: 1
m_PVRFilteringGaussRadiusIndirect: 5
m_PVRFilteringGaussRadiusAO: 2
m_PVRFilteringAtrousPositionSigmaDirect: 0.5
m_PVRFilteringAtrousPositionSigmaIndirect: 2
m_PVRFilteringAtrousPositionSigmaAO: 1
m_ShowResolutionOverlay: 1
m_LightingDataAsset: {fileID: 0}
m_UseShadowmask: 1
--- !u!196 &4
NavMeshSettings:
serializedVersion: 2
m_ObjectHideFlags: 0
m_BuildSettings:
serializedVersion: 2
agentTypeID: 0
agentRadius: 0.5
agentHeight: 2
agentSlope: 45
agentClimb: 0.4
ledgeDropHeight: 0
maxJumpAcrossDistance: 0
minRegionArea: 2
manualCellSize: 0
cellSize: 0.16666667
manualTileSize: 0
tileSize: 256
accuratePlacement: 0
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &25651912
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 25651914}
- component: {fileID: 25651913}
m_Layer: 0
m_Name: Directional Light
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!108 &25651913
Light:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 25651912}
m_Enabled: 1
serializedVersion: 8
m_Type: 1
m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
m_Intensity: 1
m_Range: 10
m_SpotAngle: 30
m_CookieSize: 10
m_Shadows:
m_Type: 2
m_Resolution: -1
m_CustomResolution: -1
m_Strength: 1
m_Bias: 0.05
m_NormalBias: 0.4
m_NearPlane: 0.2
m_Cookie: {fileID: 0}
m_DrawHalo: 0
m_Flare: {fileID: 0}
m_RenderMode: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_Lightmapping: 4
m_AreaSize: {x: 1, y: 1}
m_BounceIntensity: 1
m_ColorTemperature: 6570
m_UseColorTemperature: 0
m_ShadowRadius: 0
m_ShadowAngle: 0
--- !u!4 &25651914
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 25651912}
m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
m_LocalPosition: {x: 0, y: 3, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
--- !u!1 &1500274086
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1500274089}
- component: {fileID: 1500274088}
- component: {fileID: 1500274087}
m_Layer: 0
m_Name: EventSystem
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &1500274087
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1500274086}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1077351063, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_HorizontalAxis: Horizontal
m_VerticalAxis: Vertical
m_SubmitButton: Submit
m_CancelButton: Cancel
m_InputActionsPerSecond: 10
m_RepeatDelay: 0.5
m_ForceModuleActive: 0
--- !u!114 &1500274088
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1500274086}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -619905303, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_FirstSelected: {fileID: 0}
m_sendNavigationEvents: 1
m_DragThreshold: 5
--- !u!4 &1500274089
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1500274086}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &1802766121
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1802766122}
- component: {fileID: 1802766124}
- component: {fileID: 1802766123}
m_Layer: 5
m_Name: Title
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1802766122
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1802766121}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2026874869}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 1}
m_AnchorMax: {x: 0.5, y: 1}
m_AnchoredPosition: {x: 0, y: -15}
m_SizeDelta: {x: 290, y: 30}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1802766123
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1802766121}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 24
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 2
m_MaxSize: 40
m_Alignment: 3
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 0
m_LineSpacing: 1
m_Text: OVR Transition Scene
--- !u!222 &1802766124
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1802766121}
--- !u!1 &1955265764
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 1955265765}
- component: {fileID: 1955265767}
- component: {fileID: 1955265766}
m_Layer: 5
m_Name: Log
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &1955265765
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1955265764}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 2026874869}
m_RootOrder: 1
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: 0, y: -15}
m_SizeDelta: {x: 290, y: 270}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &1955265766
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1955265764}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 708705254, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 0.19607843, g: 0.19607843, b: 0.19607843, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_FontData:
m_Font: {fileID: 10102, guid: 0000000000000000e000000000000000, type: 0}
m_FontSize: 14
m_FontStyle: 0
m_BestFit: 0
m_MinSize: 10
m_MaxSize: 40
m_Alignment: 0
m_AlignByGeometry: 0
m_RichText: 1
m_HorizontalOverflow: 0
m_VerticalOverflow: 1
m_LineSpacing: 1
m_Text:
--- !u!222 &1955265767
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 1955265764}
--- !u!1 &2026874868
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 2026874869}
- component: {fileID: 2026874871}
- component: {fileID: 2026874870}
m_Layer: 5
m_Name: Panel
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &2026874869
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2026874868}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 1802766122}
- {fileID: 1955265765}
m_Father: {fileID: 2063971652}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 1, y: 1}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 0, y: 0}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!114 &2026874870
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2026874868}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: -765806418, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_Sprite: {fileID: 10907, guid: 0000000000000000f000000000000000, type: 0}
m_Type: 1
m_PreserveAspect: 0
m_FillCenter: 1
m_FillMethod: 4
m_FillAmount: 1
m_FillClockwise: 1
m_FillOrigin: 0
--- !u!222 &2026874871
CanvasRenderer:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2026874868}
--- !u!1 &2060762002
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 2060762004}
- component: {fileID: 2060762003}
m_Layer: 0
m_Name: OVRSceneLoader
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &2060762003
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2060762002}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a6d444f79f5ee4646b26c6d746385e80, type: 3}
m_Name:
m_EditorClassIdentifier:
sceneCheckIntervalSeconds: 1
mainCanvas: {fileID: 2063971651}
logTextBox: {fileID: 1955265766}
--- !u!4 &2060762004
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2060762002}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 2063971652}
m_Father: {fileID: 0}
m_RootOrder: 2
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &2063971648
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 2063971652}
- component: {fileID: 2063971651}
- component: {fileID: 2063971650}
- component: {fileID: 2063971649}
m_Layer: 5
m_Name: Canvas
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!114 &2063971649
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2063971648}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1301386320, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_IgnoreReversedGraphics: 1
m_BlockingObjects: 0
m_BlockingMask:
serializedVersion: 2
m_Bits: 4294967295
--- !u!114 &2063971650
MonoBehaviour:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2063971648}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 1980459831, guid: f5f67c52d1564df4a8936ccd202a3bd8, type: 3}
m_Name:
m_EditorClassIdentifier:
m_UiScaleMode: 0
m_ReferencePixelsPerUnit: 100
m_ScaleFactor: 1
m_ReferenceResolution: {x: 800, y: 600}
m_ScreenMatchMode: 0
m_MatchWidthOrHeight: 0
m_PhysicalUnit: 3
m_FallbackScreenDPI: 96
m_DefaultSpriteDPI: 96
m_DynamicPixelsPerUnit: 1
--- !u!223 &2063971651
Canvas:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2063971648}
m_Enabled: 1
serializedVersion: 3
m_RenderMode: 2
m_Camera: {fileID: 2122420806}
m_PlaneDistance: 100
m_PixelPerfect: 0
m_ReceivesEvents: 1
m_OverrideSorting: 0
m_OverridePixelPerfect: 0
m_SortingBucketNormalizedSize: 0
m_AdditionalShaderChannelsFlag: 0
m_SortingLayerID: 0
m_SortingOrder: 0
m_TargetDisplay: 0
--- !u!224 &2063971652
RectTransform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2063971648}
m_LocalRotation: {x: -0, y: -0, z: -0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 1}
m_LocalScale: {x: 0.003, y: 0.003, z: 0.003}
m_Children:
- {fileID: 2026874869}
m_Father: {fileID: 2060762004}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
m_AnchorMin: {x: 0, y: 0}
m_AnchorMax: {x: 0, y: 0}
m_AnchoredPosition: {x: 0, y: 0}
m_SizeDelta: {x: 300, y: 300}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!1 &2122420804
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
serializedVersion: 5
m_Component:
- component: {fileID: 2122420807}
- component: {fileID: 2122420806}
- component: {fileID: 2122420805}
m_Layer: 0
m_Name: Main Camera
m_TagString: MainCamera
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!81 &2122420805
AudioListener:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2122420804}
m_Enabled: 1
--- !u!20 &2122420806
Camera:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2122420804}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 2
m_BackGroundColor: {r: 0, g: 0, b: 0, a: 0}
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 1000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: -1
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &2122420807
Transform:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_GameObject: {fileID: 2122420804}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: d04724945584d684c80c6c509a8ece34
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 60086b1908918924382de37b737d3d64
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.8 KiB

View File

@ -1,116 +0,0 @@
fileFormatVersion: 2
guid: 592b5d033c5cbd6478d06dbde1d20462
TextureImporter:
internalIDToNameTable: []
externalObjects: {}
serializedVersion: 11
mipmaps:
mipMapMode: 0
enableMipMap: 0
sRGBTexture: 1
linearTexture: 0
fadeOut: 0
borderMipMap: 0
mipMapsPreserveCoverage: 0
alphaTestReferenceValue: 0.5
mipMapFadeDistanceStart: 1
mipMapFadeDistanceEnd: 3
bumpmap:
convertToNormalMap: 0
externalNormalMap: 0
heightScale: 0.25
normalMapFilter: 0
isReadable: 0
streamingMipmaps: 0
streamingMipmapsPriority: 0
grayScaleToAlpha: 0
generateCubemap: 6
cubemapConvolution: 0
seamlessCubemap: 0
textureFormat: 1
maxTextureSize: 2048
textureSettings:
serializedVersion: 2
filterMode: -1
aniso: 1
mipBias: -100
wrapU: 1
wrapV: 1
wrapW: -1
nPOTScale: 0
lightmap: 0
compressionQuality: 50
spriteMode: 0
spriteExtrude: 1
spriteMeshType: 1
alignment: 0
spritePivot: {x: 0.5, y: 0.5}
spritePixelsToUnits: 100
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
spriteGenerateFallbackPhysicsShape: 1
alphaUsage: 1
alphaIsTransparency: 1
spriteTessellationDetail: -1
textureType: 2
textureShape: 1
singleChannelComponent: 0
maxTextureSizeSet: 0
compressionQualitySet: 0
textureFormatSet: 0
applyGammaDecoding: 0
platformSettings:
- serializedVersion: 3
buildTarget: DefaultTexturePlatform
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Standalone
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
- serializedVersion: 3
buildTarget: Android
maxTextureSize: 2048
resizeAlgorithm: 0
textureFormat: -1
textureCompression: 1
compressionQuality: 50
crunchedCompression: 0
allowsAlphaSplitting: 0
overridden: 0
androidETC2FallbackOverride: 0
forceMaximumCompressionQuality_BC6H_BC7: 0
spriteSheet:
serializedVersion: 2
sprites: []
outline: []
physicsShape: []
bones: []
spriteID:
internalID: 0
vertices: []
indices:
edges: []
weights: []
secondaryTextures: []
spritePackingTag:
pSDRemoveMatte: 0
pSDShowRemoveMatteOption: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,4 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<network-security-config>
<base-config cleartextTrafficPermitted="false"></base-config>
</network-security-config>

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: b69c9b95ff9fc8a44b5e162bbca8fbcc
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,2 +0,0 @@
Copyright (c) Facebook Technologies, LLC and its affiliates. All rights reserved.
Your use of this SDK or tool is subject to the Oculus SDK License Agreement, available at https://developer.oculus.com/licenses/oculussdk/

View File

@ -1,7 +0,0 @@
fileFormatVersion: 2
guid: ea216613534b07f45adfcdd5ba09cf4e
TextScriptImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,4 +0,0 @@
fileFormatVersion: 2
guid: 981b5bce7fc4a2d43a2169710da4b892
DefaultImporter:
userData:

View File

@ -1,64 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 3
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: Arrow
m_Shader: {fileID: 10101, guid: 0000000000000000e000000000000000, type: 0}
m_ShaderKeywords: []
m_CustomRenderQueue: -1
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _Shininess
second: .699999988
data:
first:
name: _Stencil
second: 0
data:
first:
name: _StencilReadMask
second: 255
data:
first:
name: _StencilWriteMask
second: 255
data:
first:
name: _StencilComp
second: 8
data:
first:
name: _StencilOp
second: 1
data:
first:
name: _ColorMask
second: 15
m_Colors:
data:
first:
name: _Color
second: {r: 1, g: 0, b: 0, a: 1}
data:
first:
name: _Emission
second: {r: 0, g: 0, b: 0, a: 0}
data:
first:
name: _SpecColor
second: {r: 1, g: 1, b: 1, a: 1}

View File

@ -1,4 +0,0 @@
fileFormatVersion: 2
guid: 669025377795b574da66d9bb2472fcab
NativeFormatImporter:
userData:

View File

@ -1,76 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: BasicHandMaterial
m_Shader: {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: c00bf1ce0c68d5646ad7ea3d26b3486d, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 0.508
- _Glossiness: 0.389
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 5ba7d209f622bb44e87b47ce27ee27b7
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,29 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 5
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: CubeMaterial
m_Shader: {fileID: 7, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 5
m_CustomRenderQueue: -1
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 2800000, guid: 020d1a102a7f2a14ebf6cefe7b977303, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats: {}
m_Colors:
data:
first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}

View File

@ -1,4 +0,0 @@
fileFormatVersion: 2
guid: 62db2d638434d5a488dfb1e789e34b37
NativeFormatImporter:
userData:

View File

@ -1,43 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: GazePointer
m_Shader: {fileID: 4800000, guid: 38ad33c152e32ee46a9bbbb0e656f7e1, type: 3}
m_ShaderKeywords:
m_LightmapFlags: 5
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _AlphaTex:
m_Texture: {fileID: 2800000, guid: 8b000a1e9077a124f9ad4e81392fccba, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _Illum:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 82026cb669304dc4897d2c11d3753141, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _AlphaCutoff: 0
- _Cutoff: 0.5
- _EmissionLM: 0
- _EndRadius: 0.8
- _Fill: 0.5
- _InvFade: 1.11
- _StartRadius: 0.2
m_Colors:
- _Color: {r: 0, g: 1, b: 0.006896496, a: 1}
- _TintColor: {r: 0.5, g: 0.5, b: 0.5, a: 0.5}

View File

@ -1,4 +0,0 @@
fileFormatVersion: 2
guid: 3fac3b9744290eb4c89b0e4ffd5fe085
NativeFormatImporter:
userData:

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: b6adb69179640a14186daa49756cc13f
folderAsset: yes
DefaultImporter:
externalObjects: {}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,94 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: BillboardMask
m_Shader: {fileID: 4800000, guid: 488b60f10f2b48e4f9ff49f81068b166, type: 3}
m_ShaderKeywords: _EDGEFADING_ON _VIGNETTE_ON
m_LightmapFlags: 4
m_EnableInstancingVariants: 1
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 10300, guid: 0000000000000000f000000000000000, type: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _ColorMultiply: 2
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _DstBlendAlphaMode: 1
- _DstBlendMode: 3
- _EdgeFading: 1
- _FadingFalloff: 0.05
- _Falloff: 4
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Intensity: 0.75
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _Power: 14
- _Scale: 0.055
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _SrcBlendAlphaMode: 5
- _SrcBlendMode: 0
- _UVSec: 0
- _Vignette: 1
- _YOffset: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _Distort: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
- _KeyboardPosition: {r: 0, g: 0, b: 0, a: 0}
- _KeyboardRotation: {r: 0, g: 0, b: 0, a: 0}
- _KeyboardScale: {r: 1, g: 0.1, b: 1, a: 1}

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: e5efaaa7295b60c4b99c88ff76db4d0c
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,77 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: PlainMaterial
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 26cadeeaa29498d4889f43542f3add58
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,78 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: SelectionRay
m_Shader: {fileID: 10755, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 0, g: 0, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
m_BuildTextureStacks: []

View File

@ -1,9 +0,0 @@
fileFormatVersion: 2
guid: 02f4d91e963f1e74d8bee0002c24efe7
timeCreated: 1512379123
licenseType: Store
NativeFormatImporter:
mainObjectFileID: 2100000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,77 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: SelfieImage
m_Shader: {fileID: 10752, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 8400000, guid: 57e76b1057d5b458badbc9979747256e, type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 52ef173c94de14120b0d05f281d20054
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,77 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: SelfieMat
m_Shader: {fileID: 10752, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: -1
stringTagMap: {}
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 8400000, guid: 3a9b7034483494d4c9ab590cbe537560, type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 0
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 0
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 1
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}

View File

@ -1,8 +0,0 @@
fileFormatVersion: 2
guid: 8bad5fdcacc3848e08780239d9578531
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 0
userData:
assetBundleName:
assetBundleVariant:

View File

@ -1,43 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 3
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: cursor_timer_material
m_Shader: {fileID: 4800000, guid: b95caf64e2cc3614892026a94bb2be84, type: 3}
m_ShaderKeywords: []
m_CustomRenderQueue: -1
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 2800000, guid: 79a33e7a7166c6142ad50f46a9a23d3e, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ColorRamp
second:
m_Texture: {fileID: 2800000, guid: 8929c8bc5148a624b8c9d6df0ee6f0ca, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _Cutoff
second: 1
data:
first:
name: _ColorRampOffset
second: 0
m_Colors:
data:
first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}

View File

@ -1,4 +0,0 @@
fileFormatVersion: 2
guid: 9531aa878fd5c4749b288b72024e8d2f
NativeFormatImporter:
userData:

View File

@ -1,28 +0,0 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 3
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: gaze_cursor
m_Shader: {fileID: 4800000, guid: 05b53b473302943b58b8e33c93a38dac, type: 3}
m_ShaderKeywords: []
m_CustomRenderQueue: -1
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 2800000, guid: 077028084dceb584798dade6c58d1978, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats: {}
m_Colors:
data:
first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}

Some files were not shown because too many files have changed in this diff Show More