in Networked Physics/Assets/Oculus/VR/Scripts/OVRManager.cs [899:1006]
private void Awake()
{
// Only allow one instance at runtime.
if (instance != null)
{
enabled = false;
DestroyImmediate(this);
return;
}
instance = this;
Debug.Log("Unity v" + Application.unityVersion + ", " +
"Oculus Utilities v" + OVRPlugin.wrapperVersion + ", " +
"OVRPlugin v" + OVRPlugin.version + ", " +
"SDK v" + OVRPlugin.nativeSDKVersion + ".");
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
var supportedTypes =
UnityEngine.Rendering.GraphicsDeviceType.Direct3D11.ToString() + ", " +
UnityEngine.Rendering.GraphicsDeviceType.Direct3D12.ToString();
if (!supportedTypes.Contains(SystemInfo.graphicsDeviceType.ToString()))
Debug.LogWarning("VR rendering requires one of the following device types: (" + supportedTypes + "). Your graphics device: " + SystemInfo.graphicsDeviceType.ToString());
#endif
// Detect whether this platform is a supported platform
RuntimePlatform currPlatform = Application.platform;
isSupportedPlatform |= currPlatform == RuntimePlatform.Android;
//isSupportedPlatform |= currPlatform == RuntimePlatform.LinuxPlayer;
isSupportedPlatform |= currPlatform == RuntimePlatform.OSXEditor;
isSupportedPlatform |= currPlatform == RuntimePlatform.OSXPlayer;
isSupportedPlatform |= currPlatform == RuntimePlatform.WindowsEditor;
isSupportedPlatform |= currPlatform == RuntimePlatform.WindowsPlayer;
if (!isSupportedPlatform)
{
Debug.LogWarning("This platform is unsupported");
return;
}
#if UNITY_ANDROID && !UNITY_EDITOR
// Turn off chromatic aberration by default to save texture bandwidth.
chromatic = false;
#endif
#if UNITY_STANDALONE_WIN && !UNITY_EDITOR
enableMixedReality = false; // we should never start the standalone game in MxR mode, unless the command-line parameter is provided
#endif
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
bool loadMrcConfig = LoadMixedRealityCaptureConfigurationFileFromCmd();
bool createMrcConfig = CreateMixedRealityCaptureConfigurationFileFromCmd();
if (loadMrcConfig || createMrcConfig)
{
OVRMixedRealityCaptureSettings mrcSettings = ScriptableObject.CreateInstance<OVRMixedRealityCaptureSettings>();
mrcSettings.ReadFrom(this);
if (loadMrcConfig)
{
mrcSettings.CombineWithConfigurationFile();
mrcSettings.ApplyTo(this);
}
if (createMrcConfig)
{
mrcSettings.WriteToConfigurationFile();
}
ScriptableObject.Destroy(mrcSettings);
}
if (MixedRealityEnabledFromCmd())
{
enableMixedReality = true;
}
if (enableMixedReality)
{
Debug.Log("OVR: Mixed Reality mode enabled");
if (UseDirectCompositionFromCmd())
{
compositionMethod = CompositionMethod.Direct;
}
if (UseExternalCompositionFromCmd())
{
compositionMethod = CompositionMethod.External;
}
Debug.Log("OVR: CompositionMethod : " + compositionMethod);
}
#endif
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
if (enableAdaptiveResolution && !OVRManager.IsAdaptiveResSupportedByEngine())
{
enableAdaptiveResolution = false;
UnityEngine.Debug.LogError("Your current Unity Engine " + Application.unityVersion + " might have issues to support adaptive resolution, please disable it under OVRManager");
}
#endif
Initialize();
if (resetTrackerOnLoad)
display.RecenterPose();
#if UNITY_EDITOR_WIN || UNITY_STANDALONE_WIN
// Force OcculusionMesh on all the time, you can change the value to false if you really need it be off for some reasons,
// be aware there are performance drops if you don't use occlusionMesh.
OVRPlugin.occlusionMesh = true;
#endif
}