// OnPostprocessBuild() is called after the build process. It does appropriate cleanup // so that this script only affects build process for PermissionsDemo, not others. public void OnPostprocessBuild(BuildTarget target, string path) { if (!m_cardboardAddedFromCode) { return; } string[] androidVrSDKs = VREditor.GetVREnabledDevicesOnTargetGroup(BuildTargetGroup.Android); // The enabled devices are modified somehow, which shouldn't happen. Abort the post build process. if (androidVrSDKs.Length == 0 || androidVrSDKs[androidVrSDKs.Length - 1] != GvrSettings.VR_SDK_CARDBOARD) { return; } string[] androidVrSDKsShortened = new string[androidVrSDKs.Length - 1]; for (int i = 0; i < androidVrSDKsShortened.Length; i++) { androidVrSDKsShortened[i] = androidVrSDKs[i]; } VREditor.SetVREnabledOnTargetGroup( BuildTargetGroup.Android, true); VREditor.SetVREnabledDevicesOnTargetGroup( BuildTargetGroup.Android, androidVrSDKsShortened); m_cardboardAddedFromCode = false; }
/// <summary> /// Determines if this SDK is active for the current build target group. /// </summary> /// <returns>True if this is the active SDK, false otherwise.</returns> public bool IsActiveSdk() { var buildTargetGroup = EditorUserBuildSettings.selectedBuildTargetGroup; var chosenSdk = VREditor.GetVREnabledDevicesOnTargetGroup(buildTargetGroup).FirstOrDefault(); return(chosenSdk == m_Key); }
/// <summary> /// Manages (i.e. adds and removes) the VR SDKs of the <see cref="PlayerSettings"/> for the currently set SDK infos. /// This method is only available in the editor, so usage of the method needs to be surrounded by `#if UNITY_EDITOR` and `#endif` when used /// in a type that is also compiled for a standalone build. /// </summary> /// <param name="force">Whether to ignore <see cref="autoManageVRSettings"/> while deciding to manage.</param> public void ManageVRSettings(bool force) { if (EditorApplication.isPlayingOrWillChangePlaymode || !(force || autoManageVRSettings)) { return; } Dictionary <BuildTargetGroup, string[]> deviceNamesByTargetGroup = setups .Where(setup => setup != null && setup.isValid) .SelectMany(setup => new[] { setup.systemSDKInfo, setup.boundariesSDKInfo, setup.headsetSDKInfo, setup.controllerSDKInfo }) .GroupBy(info => info.description.buildTargetGroup) .ToDictionary(grouping => grouping.Key, grouping => grouping.Select(info => info.description.vrDeviceName) .Distinct() .ToArray()); foreach (BuildTargetGroup targetGroup in VRTK_SharedMethods.GetValidBuildTargetGroups()) { string[] deviceNames; deviceNamesByTargetGroup.TryGetValue(targetGroup, out deviceNames); int setupCount = deviceNames == null ? 0 : deviceNames.Length; bool vrEnabled = deviceNames != null && deviceNames.Length > 0; if (deviceNames != null) { deviceNames = deviceNames.Except(new[] { "None" }).ToArray(); } #if UNITY_5_5_OR_NEWER VREditor.SetVREnabledOnTargetGroup(targetGroup, vrEnabled); #else VREditor.SetVREnabled(targetGroup, vrEnabled); #endif string[] devices; if (vrEnabled) { devices = setupCount > 1 ? new[] { "None" }.Concat(deviceNames).ToArray() : deviceNames; } else { devices = new string[0]; } #if UNITY_5_5_OR_NEWER VREditor.SetVREnabledDevicesOnTargetGroup( #else VREditor.SetVREnabledDevices( #endif targetGroup, devices ); } }
static void DisableVRSettings() { bool didTransitionVRDevice = false; string storedGroupsTransitioned = ""; List <string> groupsTransitioned = new List <string>(); if (XRProjectSettings.HasSetting(XRProjectSettings.KnownSettings.k_VRDeviceTransitionGroups)) { XRProjectSettings.GetString(XRProjectSettings.KnownSettings.k_VRDeviceTransitionGroups, storedGroupsTransitioned); groupsTransitioned.AddRange(storedGroupsTransitioned.Split(new char[] { ',' })); } foreach (BuildTargetGroup targetGroup in (BuildTargetGroup[])Enum.GetValues(typeof(BuildTargetGroup))) { string targetGroupString = targetGroup.ToString(); if (VREditor.GetVREnabledOnTargetGroup(targetGroup)) { Debug.LogFormat("XR SDK Provider detected in project. Disabling VR Device settings for {0}", targetGroup); VREditor.SetVREnabledOnTargetGroup(targetGroup, false); didTransitionVRDevice = true; if (!groupsTransitioned.Contains(targetGroupString)) { groupsTransitioned.Add(targetGroupString); } } } if (didTransitionVRDevice) { storedGroupsTransitioned = String.Join(",", groupsTransitioned.ToArray()); XRProjectSettings.SetString(XRProjectSettings.KnownSettings.k_VRDeviceTransitionGroups, storedGroupsTransitioned); } XRProjectSettings.SetBool(XRProjectSettings.KnownSettings.k_VRDeviceDisabled, true); }
static void _SetBuildCardBoard() { PlayerSettings.use32BitDisplayBuffer = false; PlayerSettings.mobileMTRendering = true; VREditor.SetVREnabledOnTargetGroup(BuildTargetGroup.Android, true); VREditor.SetVREnabledDevicesOnTargetGroup(BuildTargetGroup.Android, _cardBoard); PlayerSettings.Android.minSdkVersion = AndroidSdkVersions.AndroidApiLevel19; }
public void DrawVR() { if (VREditor.GetVREnabledOnTargetGroup(BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget))) { EditorGUILayout.PropertyField(stereoSeparation); EditorGUILayout.PropertyField(stereoConvergence); } }
/// <summary> /// Enables this SDK for the current build target group. /// </summary> public void EnableForCurrentBuildTargetGroup() { var buildTargetGroup = EditorUserBuildSettings.selectedBuildTargetGroup; VREditor.SetVREnabledOnTargetGroup(buildTargetGroup, true); // Build an array with our key first followed by all other supported SDKs var otherSdkKeys = s_SupportedSdks[buildTargetGroup].Except(new[] { this }).Select(s => s.m_Key); VREditor.SetVREnabledDevicesOnTargetGroup(buildTargetGroup, new[] { m_Key }.Concat(otherSdkKeys).ToArray()); }
internal static Modifier_VRDevice Current(BuildTargetGroup g) { var devices = VREditor.GetVREnabledDevicesOnTargetGroup(g); var enabled = VREditor.GetVREnabledOnTargetGroup(g); return(new Modifier_VRDevice(g) { devices = devices, enabled = enabled, stereoRenderingPath = PlayerSettings.stereoRenderingPath, }); }
private bool IsWindowsMixedRealityCurrentTarget() { if (!VREditor.GetVREnabledOnTargetGroup(BuildTargetGroup.WSA)) { return(false); } if (Array.IndexOf(XRSettings.supportedDevices, "WindowsMR") < 0) { return(false); } return(true); }
public override void OnGUI(MaterialEditor materialEditor, MaterialProperty[] props) { if (!this.m_Initialized) { this.m_ShowLatLongLayout.valueChanged.AddListener(new UnityAction(materialEditor.Repaint)); this.m_ShowMirrorOnBack.valueChanged.AddListener(new UnityAction(materialEditor.Repaint)); this.m_Show3DControl.valueChanged.AddListener(new UnityAction(materialEditor.Repaint)); this.m_Initialized = true; } float labelWidth = EditorGUIUtility.labelWidth; materialEditor.SetDefaultGUIWidths(); this.ShowProp(materialEditor, ShaderGUI.FindProperty("_Tint", props)); this.ShowProp(materialEditor, ShaderGUI.FindProperty("_Exposure", props)); this.ShowProp(materialEditor, ShaderGUI.FindProperty("_Rotation", props)); this.ShowProp(materialEditor, ShaderGUI.FindProperty("_MainTex", props)); EditorGUIUtility.labelWidth = labelWidth; this.m_ShowLatLongLayout.target = (this.ShowProp(materialEditor, ShaderGUI.FindProperty("_Mapping", props)) == 1f); if (EditorGUILayout.BeginFadeGroup(this.m_ShowLatLongLayout.faded)) { this.m_ShowMirrorOnBack.target = (this.ShowProp(materialEditor, ShaderGUI.FindProperty("_ImageType", props)) == 1f); if (EditorGUILayout.BeginFadeGroup(this.m_ShowMirrorOnBack.faded)) { EditorGUI.indentLevel++; this.ShowProp(materialEditor, ShaderGUI.FindProperty("_MirrorOnBack", props)); EditorGUI.indentLevel--; } EditorGUILayout.EndFadeGroup(); this.m_Show3DControl.value = false; BuildPlatform[] buildPlatforms = BuildPlatforms.instance.buildPlatforms; for (int i = 0; i < buildPlatforms.Length; i++) { BuildPlatform buildPlatform = buildPlatforms[i]; if (VREditor.GetVREnabledOnTargetGroup(buildPlatform.targetGroup)) { this.m_Show3DControl.value = true; break; } } if (EditorGUILayout.BeginFadeGroup(this.m_Show3DControl.faded)) { this.ShowProp(materialEditor, ShaderGUI.FindProperty("_Layout", props)); } EditorGUILayout.EndFadeGroup(); } EditorGUILayout.EndFadeGroup(); materialEditor.PropertiesDefaultGUI(new MaterialProperty[0]); }
public static string GetVSProjTemplate(string version, Dictionary <WSABuildType, bool> enableDotNetNative) { bool flag = enableDotNetNative[WSABuildType.Debug]; bool flag2 = enableDotNetNative[WSABuildType.Release]; bool flag3 = enableDotNetNative[WSABuildType.Master]; string str = "TRACE;NETFX_CORE;WINDOWS_UWP;UNITY_METRO;UNITY_WSA;UNITY_UWP;UNITY_WSA_10_0"; if (VREditor.GetVREnabledOnTargetGroup(BuildTargetGroup.WSA) && (Array.IndexOf <string>(VREditor.GetVREnabledDevicesOnTargetGroup(BuildTargetGroup.WSA), "HoloLens") > -1)) { str = str + ";UNITY_HOLOGRAPHIC"; } object[] objArray1 = new object[] { "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<Project ToolsVersion=\"14.0\" DefaultTargets=\"Build\" xmlns=\"http://schemas.microsoft.com/developer/msbuild/2003\">\n <Import Project=\"$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props\" Condition=\"Exists('$(MSBuildExtensionsPath)\\$(MSBuildToolsVersion)\\Microsoft.Common.props')\" />\n <Import Project=\"{4}\" />\n <PropertyGroup>\n <Configuration Condition=\" '$(Configuration)' == '' \">Debug</Configuration>\n <Platform Condition=\" '$(Platform)' == '' \">AnyCPU</Platform>\n <ProjectGuid>{{13a45c13-3265-47b8-bc48-a553b569df55}}</ProjectGuid>\n <OutputType>AppContainerExe</OutputType>\n <AppDesignerFolder>Properties</AppDesignerFolder>\n <RootNamespace>{6}</RootNamespace>\n <AssemblyName>{7}</AssemblyName>\n <DefaultLanguage>en-US</DefaultLanguage>\n <TargetPlatformIdentifier>UAP</TargetPlatformIdentifier>\n <TargetPlatformVersion>", version, "</TargetPlatformVersion>\n <TargetPlatformMinVersion>10.0.10240.0</TargetPlatformMinVersion>\n <MinimumVisualStudioVersion>14</MinimumVisualStudioVersion>\n <EnableDotNetNativeCompatibleProfile>true</EnableDotNetNativeCompatibleProfile>\n <FileAlignment>512</FileAlignment>\n <ProjectTypeGuids>{{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A}};{{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}}</ProjectTypeGuids>\n <PackageCertificateKeyFile>{0}</PackageCertificateKeyFile>\n <AppxPackageSigningEnabled>true</AppxPackageSigningEnabled>\n <PlatformShortName>$(Platform)</PlatformShortName>\n{2} <AllowedReferenceRelatedFileExtensions>\n $(AllowedReferenceRelatedFileExtensions);\n _UAP_$(Platform)_$(Configuration)_dotnet.pdb;\n .pdb;\n </AllowedReferenceRelatedFileExtensions>\n </PropertyGroup>\n <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Debug|ARM'\">\n <DebugSymbols>true</DebugSymbols>\n <OutputPath>bin\\ARM\\Debug\\</OutputPath>\n <DefineConstants>DEBUG;", str, "</DefineConstants>\n <NoWarn>;2008</NoWarn>\n <DebugType>full</DebugType>\n <PlatformTarget>ARM</PlatformTarget>\n <UseVSHostingProcess>false</UseVSHostingProcess>\n <ErrorReport>prompt</ErrorReport>\n <Prefer32Bit>true</Prefer32Bit>\n <UseDotNetNativeToolchain>", flag, "</UseDotNetNativeToolchain>\n </PropertyGroup>\n <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Release|ARM'\">\n <OutputPath>bin\\ARM\\Release\\</OutputPath>\n <DefineConstants>", str, "</DefineConstants>\n <Optimize>true</Optimize>\n <NoWarn>;2008</NoWarn>\n <DebugType>pdbonly</DebugType>\n <PlatformTarget>ARM</PlatformTarget>\n <UseVSHostingProcess>false</UseVSHostingProcess>\n <ErrorReport>prompt</ErrorReport>\n <Prefer32Bit>true</Prefer32Bit>\n <UseDotNetNativeToolchain>", flag2, "</UseDotNetNativeToolchain>\n </PropertyGroup>\n <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Master|ARM'\">\n <OutputPath>bin\\ARM\\Master\\</OutputPath>\n <DefineConstants>", str, "</DefineConstants>\n <Optimize>true</Optimize>\n <NoWarn>;2008</NoWarn>\n <DebugType>pdbonly</DebugType>\n <PlatformTarget>ARM</PlatformTarget>\n <UseVSHostingProcess>false</UseVSHostingProcess>\n <ErrorReport>prompt</ErrorReport>\n <Prefer32Bit>true</Prefer32Bit>\n <UseDotNetNativeToolchain>", flag3, "</UseDotNetNativeToolchain>\n </PropertyGroup>\n <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Debug|x64'\">\n <DebugSymbols>true</DebugSymbols>\n <OutputPath>bin\\x64\\Debug\\</OutputPath>\n <DefineConstants>DEBUG;", str, "</DefineConstants>\n <NoWarn>;2008</NoWarn>\n <DebugType>full</DebugType>\n <PlatformTarget>x64</PlatformTarget>\n <UseVSHostingProcess>false</UseVSHostingProcess>\n <ErrorReport>prompt</ErrorReport>\n <Prefer32Bit>true</Prefer32Bit>\n <UseDotNetNativeToolchain>", flag, "</UseDotNetNativeToolchain>\n </PropertyGroup>\n <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Release|x64'\">\n <OutputPath>bin\\x64\\Release\\</OutputPath>\n <DefineConstants>", str, "</DefineConstants>\n <Optimize>true</Optimize>\n <NoWarn>;2008</NoWarn>\n <DebugType>pdbonly</DebugType>\n <PlatformTarget>x64</PlatformTarget>\n <UseVSHostingProcess>false</UseVSHostingProcess>\n <ErrorReport>prompt</ErrorReport>\n <Prefer32Bit>true</Prefer32Bit>\n <UseDotNetNativeToolchain>", flag2, "</UseDotNetNativeToolchain>\n </PropertyGroup>\n <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Master|x64'\">\n <OutputPath>bin\\x64\\Master\\</OutputPath>\n <DefineConstants>", str, "</DefineConstants>\n <Optimize>true</Optimize>\n <NoWarn>;2008</NoWarn>\n <DebugType>pdbonly</DebugType>\n <PlatformTarget>x64</PlatformTarget>\n <UseVSHostingProcess>false</UseVSHostingProcess>\n <ErrorReport>prompt</ErrorReport>\n <Prefer32Bit>true</Prefer32Bit>\n <UseDotNetNativeToolchain>", flag3, "</UseDotNetNativeToolchain>\n </PropertyGroup>\n <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Debug|x86'\">\n <DebugSymbols>true</DebugSymbols>\n <OutputPath>bin\\x86\\Debug\\</OutputPath>\n <DefineConstants>DEBUG;", str, "</DefineConstants>\n <NoWarn>;2008</NoWarn>\n <DebugType>full</DebugType>\n <PlatformTarget>x86</PlatformTarget>\n <UseVSHostingProcess>false</UseVSHostingProcess>\n <ErrorReport>prompt</ErrorReport>\n <Prefer32Bit>true</Prefer32Bit>\n <UseDotNetNativeToolchain>", flag, "</UseDotNetNativeToolchain>\n </PropertyGroup>\n <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Release|x86'\">\n <OutputPath>bin\\x86\\Release\\</OutputPath>\n <DefineConstants>", str, "</DefineConstants>\n <Optimize>true</Optimize>\n <NoWarn>;2008</NoWarn>\n <DebugType>pdbonly</DebugType>\n <PlatformTarget>x86</PlatformTarget>\n <UseVSHostingProcess>false</UseVSHostingProcess>\n <ErrorReport>prompt</ErrorReport>\n <Prefer32Bit>true</Prefer32Bit>\n <UseDotNetNativeToolchain>", flag2, "</UseDotNetNativeToolchain>\n </PropertyGroup>\n <PropertyGroup Condition=\"'$(Configuration)|$(Platform)' == 'Master|x86'\">\n <OutputPath>bin\\x86\\Master\\</OutputPath>\n <DefineConstants>", str, "</DefineConstants>\n <Optimize>true</Optimize>\n <NoWarn>;2008</NoWarn>\n <DebugType>pdbonly</DebugType>\n <PlatformTarget>x86</PlatformTarget>\n <UseVSHostingProcess>false</UseVSHostingProcess>\n <ErrorReport>prompt</ErrorReport>\n <Prefer32Bit>true</Prefer32Bit>\n <UseDotNetNativeToolchain>", flag3, "</UseDotNetNativeToolchain>\n </PropertyGroup>\n <PropertyGroup Condition=\"'$(Platform)' == 'x64'\">\n <UnityBits>64</UnityBits>\n </PropertyGroup>\n <PropertyGroup Condition=\"'$(Platform)' != 'x64'\">\n <UnityBits>32</UnityBits>\n </PropertyGroup>\n <ItemGroup>\n <!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->\n <None Include=\"project.json\" />\n <SDKReference Include=\"Microsoft.VCLibs, Version=14.0\">\n <Name>Visual C++ 2015 Runtime for Universal Windows Platform Apps</Name>\n </SDKReference>\n <SDKReference Include=\"WindowsMobile, Version=", version, "\">\n <Name>Windows Mobile Extensions for the UWP</Name>\n </SDKReference>\n </ItemGroup>\n <ItemGroup>\n{1} <Content Include=\"Data\\**\" />\n </ItemGroup>\n <ItemGroup>\n <AppxManifest Include=\"Package.appxmanifest\">\n <SubType>Designer</SubType>\n </AppxManifest>\n <None Include=\"{0}\" />\n </ItemGroup>\n{5} <ItemGroup>\n <Reference Include=\"UnityPlayer\">\n <SpecificVersion>False</SpecificVersion>\n <HintPath>..\\Players\\$(PlatformTarget)\\$(Configuration)\\UnityPlayer.winmd</HintPath>\n </Reference>\n <Reference Include=\"WinRTBridge\">\n <SpecificVersion>False</SpecificVersion>\n <HintPath>..\\Players\\$(PlatformTarget)\\$(Configuration)\\WinRTBridge.winmd</HintPath>\n </Reference>\n <Reference Include=\"BridgeInterface\">\n <SpecificVersion>False</SpecificVersion>\n <HintPath>..\\Players\\$(PlatformTarget)\\$(Configuration)\\BridgeInterface.winmd</HintPath>\n </Reference>\n <Reference Include=\"UnityEngineDelegates\">\n <SpecificVersion>False</SpecificVersion>\n <HintPath>..\\Players\\$(PlatformTarget)\\$(Configuration)\\UnityEngineDelegates.winmd</HintPath>\n </Reference>\n <Reference Include=\"UnityEngineProxy\">\n <SpecificVersion>False</SpecificVersion>\n <HintPath>..\\Players\\$(PlatformTarget)\\$(Configuration)\\UnityEngineProxy.dll</HintPath>\n </Reference>\n </ItemGroup>\n <PropertyGroup Condition=\" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' < '14.0' \">\n <VisualStudioVersion>14.0</VisualStudioVersion>\n </PropertyGroup>\n{3} <Import Project=\"$(MSBuildExtensionsPath)\\Microsoft\\WindowsXaml\\v$(VisualStudioVersion)\\Microsoft.Windows.UI.Xaml.CSharp.targets\" />\n <ItemGroup>\n <UnprocessedFile Include=\"$(ProjectDir)Unprocessed\\*\" />\n </ItemGroup>\n <!-- To modify your build process, add your task inside one of the targets below and uncomment it.\n Other similar extension points exist, see Microsoft.Common.targets.\n <Target Name=\"BeforeBuild\">\n </Target>\n\n -->\n {8}\n</Project>\n" }; return(string.Concat(objArray1).FixLineEndings()); }
static void EnableVRSettings() { string storedGroupsTransitioned = ""; List <string> groupsTransitioned = new List <string>(); XRProjectSettings.SetBool(XRProjectSettings.KnownSettings.k_VRDeviceDisabled, false); XRProjectSettings.SetBool(XRProjectSettings.KnownSettings.k_VRDeviceDidAlertUser, false); if (XRProjectSettings.HasSetting(XRProjectSettings.KnownSettings.k_VRDeviceTransitionGroups)) { storedGroupsTransitioned = XRProjectSettings.GetString(XRProjectSettings.KnownSettings.k_VRDeviceTransitionGroups); groupsTransitioned.AddRange(storedGroupsTransitioned.Split(new char[] { ',' })); foreach (var tg in groupsTransitioned) { BuildTargetGroup targetGroup; try { targetGroup = (BuildTargetGroup)Enum.Parse(typeof(BuildTargetGroup), tg); } catch (Exception ex) { String logMsg = String.Format("Error converting build target group names {0}.\n", tg); logMsg += ex.Message; Debug.LogError(logMsg); continue; } Debug.LogFormat("No XR SDK Provider detected in project. Re-enabling VR Device settings for {0}", targetGroup); VREditor.SetVREnabledOnTargetGroup(targetGroup, true); IVRDeviceSettingsTransition settingsTransition = GetTypeWithBuildTargetGroupAttribute(targetGroup); if (settingsTransition != null) { settingsTransition.EnableSettings(); } } XRProjectSettings.RemoveSetting(XRProjectSettings.KnownSettings.k_VRDeviceTransitionGroups); } }
private static bool IsVRModuleUsed(BuildTarget target) { BuildTargetGroup buildTargetGroup = BuildPipeline.GetBuildTargetGroup(target); bool result; if (buildTargetGroup != BuildTargetGroup.iPhone) { result = false; } else if (!PlayerSettings.virtualRealitySupported) { result = false; } else { string[] vREnabledDevicesOnTargetGroup = VREditor.GetVREnabledDevicesOnTargetGroup(buildTargetGroup); result = (Array.IndexOf <string>(vREnabledDevicesOnTargetGroup, "cardboard") >= 0); } return(result); }
/// <summary> /// Check the XRSettings Whether Turn On,and List SDK As "None" First,"cardboard" Second /// </summary> /// <returns>return true if XRSetting right</returns> private static bool CheckXRSettings(BuildTargetGroup targetGroup) { bool value = false; if (!VREditor.GetVREnabledOnTargetGroup(targetGroup)) { return(value); } string[] vrDevices = VREditor.GetVREnabledDevicesOnTargetGroup(targetGroup); if (vrDevices.Length == 2) { //Debug.Log(vrDevices[0]+":"+ vrDevices[1]); if (vrDevices[0] == "None" && vrDevices[1] == "cardboard") { value = true; } } return(value); }
/// <summary> /// Builds for the given build target. /// </summary> /// <param name="bt">Build target.</param> /// <param name="scenes">Scenes to include.</param> /// <param name="bo">Build options.</param> private void BuildPlatform(BuildTarget bt, string[] scenes, BuildOptions bo) { if (BuildPipeline.isBuildingPlayer) { return; } var pathToCreate = _buildOutput; if (Path.HasExtension(_buildOutput)) { pathToCreate = Path.GetDirectoryName(_buildOutput); } if (!Directory.Exists(pathToCreate)) { Directory.CreateDirectory(pathToCreate); } if (_buildSettings.IsCardboard && (bt == BuildTarget.Android || bt == BuildTarget.iOS)) { VRDeviceInfoEditor[] allVRDeviceInfo = VREditor.GetAllVRDeviceInfo(bt == BuildTarget.Android ? BuildTargetGroup.Android : BuildTargetGroup.iOS); VREditor.SetVREnabledOnTargetGroup(bt == BuildTarget.Android ? BuildTargetGroup.Android : BuildTargetGroup.iOS, true); VREditor.SetVREnabledDevicesOnTargetGroup(BuildTargetGroup.Android, new[] { allVRDeviceInfo.Select(_ => _.deviceNameKey).FirstOrDefault(_ => _.ToLowerInvariant().StartsWith("cardboard")) }); } else if (_buildSettings.IsGearVR && bt == BuildTarget.Android) { VRDeviceInfoEditor[] allVRDeviceInfo = VREditor.GetAllVRDeviceInfo(BuildTargetGroup.Android); VREditor.SetVREnabledOnTargetGroup(BuildTargetGroup.Android, true); VREditor.SetVREnabledDevicesOnTargetGroup(BuildTargetGroup.Android, new[] { allVRDeviceInfo.Select(_ => _.deviceNameKey).FirstOrDefault(_ => _.ToLowerInvariant().StartsWith("oculus")) }); } var error = BuildPipeline.BuildPlayer(GetScenes(scenes), _buildOutput, bt, bo); if (!string.IsNullOrEmpty(error.ToString())) { Debug.LogError(error); } }
public override void OnInspectorGUI() { settings.Update(); var c = (Camera)target; m_ShowBGColorOptions.target = !clearFlagsHasMultipleValues && (c.clearFlags == CameraClearFlags.SolidColor || c.clearFlags == CameraClearFlags.Skybox); m_ShowOrthoOptions.target = !orthographicHasMultipleValues && c.orthographic; bool displaySubsystemPresent = displayDescriptors.Count > 0; m_ShowTargetEyeOption.target = targetEyeValue != (int)StereoTargetEyeMask.Both || VREditor.GetVREnabledOnTargetGroup(BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget)) || displaySubsystemPresent; settings.DrawClearFlags(); if (EditorGUILayout.BeginFadeGroup(m_ShowBGColorOptions.faded)) { settings.DrawBackgroundColor(); } EditorGUILayout.EndFadeGroup(); settings.DrawCullingMask(); EditorGUILayout.Space(); settings.DrawProjection(); if (displaySubsystemPresent && targetEyeValue != (int)StereoTargetEyeMask.None && c.orthographic && c.targetTexture == null) { GUILayout.Label(EditorGUIUtility.TrTextContent("Orthographic projection is not supported when running in XR.", "One or more XR Plug-in providers were detected in your project. Using Orthographic projection is not supported when running in XR and enabling this may cause problems.", EditorGUIUtility.warningIcon)); } settings.DrawClippingPlanes(); settings.DrawNormalizedViewPort(); EditorGUILayout.Space(); settings.DrawDepth(); settings.DrawRenderingPath(); if (m_ShowOrthoOptions.target && wantDeferredRendering) { EditorGUILayout.HelpBox("Deferred rendering does not work with Orthographic camera, will use Forward.", MessageType.Warning, true); } settings.DrawTargetTexture(wantDeferredRendering); settings.DrawOcclusionCulling(); settings.DrawHDR(); settings.DrawMSAA(); settings.DrawDynamicResolution(); foreach (Camera camera in targets) { if (camera != null) { Settings.DrawCameraWarnings(camera); } } settings.DrawVR(); EditorGUILayout.Space(); settings.DrawMultiDisplay(); if (EditorGUILayout.BeginFadeGroup(m_ShowTargetEyeOption.faded)) { settings.DrawTargetEye(); } EditorGUILayout.EndFadeGroup(); DepthTextureModeGUI(); CommandBufferGUI(); serializedObject.ApplyModifiedProperties(); }
public void OnEnable() { settings.OnEnable(); var c = (Camera)target; m_ShowBGColorOptions.value = !clearFlagsHasMultipleValues && (c.clearFlags == CameraClearFlags.SolidColor || c.clearFlags == CameraClearFlags.Skybox); m_ShowOrthoOptions.value = c.orthographic; m_ShowTargetEyeOption.value = targetEyeValue != (int)StereoTargetEyeMask.Both || VREditor.GetVREnabledOnTargetGroup(BuildPipeline.GetBuildTargetGroup(EditorUserBuildSettings.activeBuildTarget)); m_ShowBGColorOptions.valueChanged.AddListener(Repaint); m_ShowOrthoOptions.valueChanged.AddListener(Repaint); m_ShowTargetEyeOption.valueChanged.AddListener(Repaint); SubsystemManager.GetSubsystemDescriptors(displayDescriptors); SubsystemManager.afterReloadSubsystems += OnReloadSubsystemsComplete; }
protected virtual void OnGUI() { GUILayout.BeginVertical(); //Draw the Title GUILayout.Space(10); GUILayout.Label("<color=red>Lenovo MirageAR Settings</color>", m_TitleStyle); //Image Title //var resourcePath = GetResourcePath(); //var logo = AssetDatabase.LoadAssetAtPath<Texture2D>(resourcePath + "lenovo_logo_red.png"); //var rect = GUILayoutUtility.GetRect(position.width, 150, GUI.skin.box); //if (logo) // GUI.DrawTexture(rect, logo, ScaleMode.ScaleToFit); //Draw help text EditorGUILayout.HelpBox("Recommended project settings for LenovoMirageAR!", MessageType.Warning); #if !UNITY_2017_2 EditorGUILayout.HelpBox("Recommended Use Unity 2017.2.0f3!", MessageType.Error); #endif DrawSeparator(); m_ScrollPosition = EditorGUILayout.BeginScrollView(m_ScrollPosition); //1,Check Build Target #region Build Target Setting EditorGUILayout.LabelField("Build Target Setting", m_HeaderStyle); GUILayout.Space(10); BeginGroup(); EditorGUILayout.BeginHorizontal(); if (s_BuildTargetNames == null) { BuildTargetTypes(); } buildTargetPopupIndex = EditorGUILayout.Popup("Build Target", buildTargetPopupIndex, s_BuildTargetNames); switch (buildTargetPopupIndex) { case 0: if (EditorUserBuildSettings.activeBuildTarget != recommended_BuildTarget_Android) { if (GUILayout.Button("Switch", GUILayout.Width(80))) { EditorUserBuildSettings.SwitchActiveBuildTargetAsync(BuildTargetGroup.Android, recommended_BuildTarget_Android); } } break; case 1: if (EditorUserBuildSettings.activeBuildTarget != recommended_BuildTarget_iOS) { if (GUILayout.Button("Switch", GUILayout.Width(80))) { EditorUserBuildSettings.SwitchActiveBuildTargetAsync(BuildTargetGroup.iOS, recommended_BuildTarget_iOS); } } break; default: break; } GUILayout.Space(10); GUILayout.EndHorizontal(); EndGroup(); if (EditorUserBuildSettings.activeBuildTarget != recommended_BuildTarget_Android && EditorUserBuildSettings.activeBuildTarget != recommended_BuildTarget_iOS) { //Draw help text EditorGUILayout.HelpBox("LenovoMirageAR Only Support Anndroid&iOS,Please Switch To Target Platform First!", MessageType.Error); EditorGUILayout.EndScrollView(); GUILayout.EndVertical(); return; } #endregion Build Target Setting int numItems = 0; DrawSeparator(); EditorGUILayout.LabelField("Build Settings", m_HeaderStyle); GUILayout.Space(10); BeginGroup(); //2,Check Build Setting for Android if (EditorUserBuildSettings.activeBuildTarget == recommended_BuildTarget_Android) { //Orientation Right if (!CheckOrientation()) { ++numItems; GUILayout.Label(defaultOrientation + string.Format(currentValue, PlayerSettings.defaultInterfaceOrientation)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, recommended_defaultOrientation))) { SetOrientation(); } GUILayout.EndHorizontal(); } //Show SplashScreen if (!CheckShowSplashScreen()) { ++numItems; GUILayout.Label(showSplashScreen + string.Format(currentValue, PlayerSettings.SplashScreen.show)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, recommended_showSplashScreen))) { SetShowSplashScreen(); } GUILayout.EndHorizontal(); } //Android min SDK if (!CheckAndroidMinSDK()) { ++numItems; GUILayout.Label(AndroidMinSDK + string.Format(currentValue, PlayerSettings.Android.minSdkVersion)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, recommended_AndroidMinSDK))) { SetAndroidMinSDK(); } GUILayout.EndHorizontal(); } //Andrid Target SDK if (!CheckAndroidTargetSDK()) { ++numItems; GUILayout.Label(AndroidTargetSDK + string.Format(currentValue, PlayerSettings.Android.targetSdkVersion)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, recommended_AndroidTargetSDK))) { SetAndroidTargetSDK(); } GUILayout.EndHorizontal(); } //XR Setting if (!CheckXRSettings(BuildTargetGroup.Android)) { ++numItems; string value = string.Empty; if (VREditor.GetVREnabledOnTargetGroup(BuildTargetGroup.Android)) { value = "VR Enalbe;Devices="; string[] currentSupportDevices = VREditor.GetVREnabledDevicesOnTargetGroup(BuildTargetGroup.Android); if (currentSupportDevices.Length == 0) { value += "Empty"; } else { value += string.Join(",", currentSupportDevices); } } else { value = "VR Disable"; } GUILayout.Label(XRSettings + string.Format(currentValue, value)); GUILayout.BeginHorizontal(); string recommend = recommended_VirtualRealitySDKs_First + "," + recommended_VirtualRealitySDKs_Second; if (GUILayout.Button(string.Format(useRecommended, recommend))) { SetXRSettings(BuildTargetGroup.Android); } GUILayout.EndHorizontal(); } //Scrip DefineSymbols if (!CheckScriptingDefineSymbols(BuildTargetGroup.Android)) { ++numItems; GUILayout.Label(string.Format("{0} miss {1}", ScriptingDefineSymbols, recommended_VRTKMirageScriptingDefineSymbols)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, recommended_VRTKMirageScriptingDefineSymbols))) { SetScriptingDefineSymbols(BuildTargetGroup.Android); } GUILayout.EndHorizontal(); } //Start Scene if (!CheckStartScene()) { ++numItems; string labelText = ""; if (EditorBuildSettings.scenes.Length == 0) { labelText = string.Format(currentValue, "null"); } else if (EditorBuildSettings.scenes[0].path != recommended_StartScene) { labelText = string.Format(currentValue, EditorBuildSettings.scenes[0].path); } else if (!EditorBuildSettings.scenes[0].enabled) { labelText = string.Format(currentValue, EditorBuildSettings.scenes[0].path + " disable"); } GUILayout.Label(StartScene + labelText); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, recommended_StartScene))) { SetStartScene(); } GUILayout.EndHorizontal(); } } else if (EditorUserBuildSettings.activeBuildTarget == recommended_BuildTarget_iOS) //2,Check Build Setting for iOS { //Orientation Right if (PlayerSettings.defaultInterfaceOrientation != recommended_defaultOrientation) { ++numItems; GUILayout.Label(defaultOrientation + string.Format(currentValue, PlayerSettings.defaultInterfaceOrientation)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, recommended_defaultOrientation))) { PlayerSettings.defaultInterfaceOrientation = recommended_defaultOrientation; } GUILayout.EndHorizontal(); } //Show SplashScreen if (!CheckShowSplashScreen()) { ++numItems; GUILayout.Label(showSplashScreen + string.Format(currentValue, PlayerSettings.SplashScreen.show)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, recommended_showSplashScreen))) { SetShowSplashScreen(); } GUILayout.EndHorizontal(); } //XR Setting if (!(CheckXRSettings(BuildTargetGroup.iOS))) { ++numItems; string value = string.Empty; if (VREditor.GetVREnabledOnTargetGroup(BuildTargetGroup.iOS)) { value = "VR Enalbe;Devices="; string[] currentSupportDevices = VREditor.GetVREnabledDevicesOnTargetGroup(BuildTargetGroup.iOS); if (currentSupportDevices.Length == 0) { value += "Empty"; } else { value += string.Join(",", currentSupportDevices); } } else { value = "VR Disable"; } GUILayout.Label(XRSettings + string.Format(currentValue, value)); GUILayout.BeginHorizontal(); string recommend = recommended_VirtualRealitySDKs_First + "," + recommended_VirtualRealitySDKs_Second; if (GUILayout.Button(string.Format(useRecommended, recommend))) { VREditor.SetVREnabledOnTargetGroup(BuildTargetGroup.iOS, true); VREditor.SetVREnabledDevicesOnTargetGroup(BuildTargetGroup.iOS, VRDevice); } GUILayout.EndHorizontal(); } //Scrip DefineSymbols if (!CheckScriptingDefineSymbols(BuildTargetGroup.iOS)) { ++numItems; GUILayout.Label(string.Format("{0} miss {1}", ScriptingDefineSymbols, recommended_VRTKMirageScriptingDefineSymbols)); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, recommended_VRTKMirageScriptingDefineSymbols))) { SetScriptingDefineSymbols(BuildTargetGroup.iOS); } GUILayout.EndHorizontal(); } //Start Scene if (!CheckStartScene()) { ++numItems; string labelText = ""; if (EditorBuildSettings.scenes.Length == 0) { labelText = string.Format(currentValue, "null"); } else if (EditorBuildSettings.scenes[0].path != recommended_StartScene) { labelText = string.Format(currentValue, EditorBuildSettings.scenes[0].path); } else if (!EditorBuildSettings.scenes[0].enabled) { labelText = string.Format(currentValue, EditorBuildSettings.scenes[0].path + " disable"); } GUILayout.Label(StartScene + labelText); GUILayout.BeginHorizontal(); if (GUILayout.Button(string.Format(useRecommended, recommended_StartScene))) { SetStartScene(); } GUILayout.EndHorizontal(); } } EndGroup(); if (numItems > 0) { EditorGUILayout.EndScrollView(); GUILayout.EndVertical(); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Accept All")) { SetBuildSettings(); } GUILayout.EndHorizontal(); } else { GUILayout.Label("<color=green>Set Correctly!</color>", m_TitleStyle); EditorGUILayout.EndScrollView(); GUILayout.EndVertical(); GUILayout.FlexibleSpace(); GUILayout.BeginHorizontal(); if (GUILayout.Button("Close")) { Close(); } GUILayout.EndHorizontal(); } }
// OnPreprocessBuild() is called right before the build process begins. If it // detects that the first enabled scene in the build arrays is the PermissionsDemo, // and Daydream is in the VR SDKs, it will add Cardboard to the VR SDKs. Because // the PermissionsDemo needs a perm statement in the Manifest while other demos don't. // Adding Cardboard to VR SDKs will merge in the Manifest-Cardboard which has perm // statement in it. public void OnPreprocessBuild(BuildTarget target, string path) { m_cardboardAddedFromCode = false; string[] androidVrSDKs = VREditor.GetVREnabledDevicesOnTargetGroup(BuildTargetGroup.Android); EditorBuildSettingsScene[] scenes = EditorBuildSettings.scenes; // See if PermissionsDemo is the first enabled scene in the array of scenes to build. for (int i = 0; i < scenes.Length; i++) { if (scenes[i].path.Contains(SCENE_NAME_PERMISSIONS_DEMO)) { if (!scenes[i].enabled) { return; } else { break; } } else { if (scenes[i].enabled) { return; } } } bool hasCardboard = Array.Exists <string>(androidVrSDKs, element => element.Equals(GvrSettings.VR_SDK_CARDBOARD)); if (hasCardboard) { return; } bool hasDaydream = Array.Exists <string>(androidVrSDKs, element => element.Equals(GvrSettings.VR_SDK_DAYDREAM)); if (!hasDaydream) { return; } string[] androidVrSDKsAppended = new string[androidVrSDKs.Length + 1]; for (int i = 0; i < androidVrSDKs.Length; i++) { androidVrSDKsAppended[i] = androidVrSDKs[i]; } androidVrSDKsAppended[androidVrSDKsAppended.Length - 1] = GvrSettings.VR_SDK_CARDBOARD; VREditor.SetVREnabledOnTargetGroup( BuildTargetGroup.Android, true); VREditor.SetVREnabledDevicesOnTargetGroup( BuildTargetGroup.Android, androidVrSDKsAppended); m_cardboardAddedFromCode = true; }
private static void Update() { bool show = (!EditorPrefs.HasKey(ignore + buildTarget) && EditorUserBuildSettings.activeBuildTarget != recommended_BuildTarget) || (!EditorPrefs.HasKey(ignore + showUnitySplashScreen) && #if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) PlayerSettings.showUnitySplashScreen != recommended_ShowUnitySplashScreen) || #else PlayerSettings.SplashScreen.show != recommended_ShowUnitySplashScreen) || #endif (!EditorPrefs.HasKey(ignore + defaultIsFullScreen) && PlayerSettings.defaultIsFullScreen != recommended_DefaultIsFullScreen) || (!EditorPrefs.HasKey(ignore + defaultScreenSize) && (PlayerSettings.defaultScreenWidth != recommended_DefaultScreenWidth || PlayerSettings.defaultScreenHeight != recommended_DefaultScreenHeight)) || (!EditorPrefs.HasKey(ignore + runInBackground) && PlayerSettings.runInBackground != recommended_RunInBackground) || (!EditorPrefs.HasKey(ignore + displayResolutionDialog) && PlayerSettings.displayResolutionDialog != recommended_DisplayResolutionDialog) || (!EditorPrefs.HasKey(ignore + resizableWindow) && PlayerSettings.resizableWindow != recommended_ResizableWindow) || (!EditorPrefs.HasKey(ignore + fullscreenMode) && PlayerSettings.d3d11FullscreenMode != recommended_FullscreenMode) || (!EditorPrefs.HasKey(ignore + visibleInBackground) && PlayerSettings.visibleInBackground != recommended_VisibleInBackground) || #if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) (!EditorPrefs.HasKey(ignore + renderingPath) && PlayerSettings.renderingPath != recommended_RenderPath) || #endif (!EditorPrefs.HasKey(ignore + colorSpace) && PlayerSettings.colorSpace != recommended_ColorSpace) || (!EditorPrefs.HasKey(ignore + gpuSkinning) && PlayerSettings.gpuSkinning != recommended_GpuSkinning) || #if false (!EditorPrefs.HasKey(ignore + singlePassStereoRendering) && PlayerSettings.singlePassStereoRendering != recommended_SinglePassStereoRendering) || #endif forceShow; if (show) { window = GetWindow <SteamVR_Settings>(true); window.minSize = new Vector2(320, 440); //window.title = "SteamVR"; } if (SteamVR_Preferences.AutoEnableVR) { // Switch to native OpenVR support. var updated = false; if (!PlayerSettings.virtualRealitySupported) { PlayerSettings.virtualRealitySupported = true; updated = true; } #if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) var devices = UnityEditorInternal.VR.VREditor.GetVREnabledDevices(BuildTargetGroup.Standalone); #else var devices = VREditor.GetVREnabledDevicesOnTargetGroup(BuildTargetGroup.Standalone); #endif var hasOpenVR = false; foreach (var device in devices) { if (device.ToLower() == "openvr") { hasOpenVR = true; } } if (!hasOpenVR) { string[] newDevices; if (updated) { newDevices = new[] { "OpenVR" }; } else { newDevices = new string[devices.Length + 1]; for (int i = 0; i < devices.Length; i++) { newDevices[i] = devices[i]; } newDevices[devices.Length] = "OpenVR"; updated = true; } #if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) UnityEditorInternal.VR.VREditor.SetVREnabledDevices(BuildTargetGroup.Standalone, newDevices); #else VREditor.SetVREnabledDevicesOnTargetGroup(BuildTargetGroup.Standalone, newDevices); #endif } if (updated) { Debug.Log("Switching to native OpenVR support."); } } var dlls = new[] { "Plugins/x86/openvr_api.dll", "Plugins/x86_64/openvr_api.dll" }; foreach (var path in dlls) { if (!File.Exists(Application.dataPath + "/" + path)) { continue; } if (AssetDatabase.DeleteAsset("Assets/" + path)) { Debug.Log("Deleting " + path); } else { Debug.Log(path + " in use; cannot delete. Please restart Unity to complete upgrade."); } } EditorApplication.update -= Update; }
private void RefreshData() { stringBuilder.Length = 0; Assembly editorAssembly = typeof(VRTK_SDKManagerEditor).Assembly; Assembly assembly = typeof(VRTK_SDKManager).Assembly; Append( "Versions", () => { Append("Unity", InternalEditorUtility.GetFullUnityVersion()); Type steamVRUpdateType = editorAssembly.GetType("SteamVR_Update"); if (steamVRUpdateType != null) { FieldInfo currentVersionField = steamVRUpdateType.GetField("currentVersion", BindingFlags.NonPublic | BindingFlags.Static); if (currentVersionField != null) { string currentVersion = (string)currentVersionField.GetValue(null); Append("SteamVR", currentVersion); } } Type ovrPluginType = assembly.GetType("OVRPlugin"); if (ovrPluginType != null) { Append( "OVRPlugin (Oculus Utilities)", () => { FieldInfo wrapperVersionField = ovrPluginType.GetField("wrapperVersion", BindingFlags.Public | BindingFlags.Static); if (wrapperVersionField != null) { Version wrapperVersion = (Version)wrapperVersionField.GetValue(null); Append("wrapperVersion", wrapperVersion); } PropertyInfo versionField = ovrPluginType.GetProperty("version", BindingFlags.Public | BindingFlags.Static); if (versionField != null) { Version version = (Version)versionField.GetGetMethod().Invoke(null, null); Append("version", version); } PropertyInfo nativeSDKVersionField = ovrPluginType.GetProperty("nativeSDKVersion", BindingFlags.Public | BindingFlags.Static); if (nativeSDKVersionField != null) { Version nativeSDKVersion = (Version)nativeSDKVersionField.GetGetMethod().Invoke(null, null); Append("nativeSDKVersion", nativeSDKVersion); } } ); } } ); Append( "VR Settings", () => { foreach (BuildTargetGroup targetGroup in VRTK_SharedMethods.GetValidBuildTargetGroups()) { bool isVREnabled; #if UNITY_5_5_OR_NEWER isVREnabled = VREditor.GetVREnabledOnTargetGroup(targetGroup); #else isVREnabled = VREditor.GetVREnabled(targetGroup); #endif if (!isVREnabled) { continue; } string[] vrEnabledDevices; #if UNITY_5_5_OR_NEWER vrEnabledDevices = VREditor.GetVREnabledDevicesOnTargetGroup(targetGroup); #else vrEnabledDevices = VREditor.GetVREnabledDevices(targetGroup); #endif Append(targetGroup, string.Join(", ", vrEnabledDevices)); } } ); Append( "Scripting Define Symbols", () => { foreach (BuildTargetGroup targetGroup in VRTK_SharedMethods.GetValidBuildTargetGroups()) { string symbols = PlayerSettings.GetScriptingDefineSymbolsForGroup(targetGroup); if (!string.IsNullOrEmpty(symbols)) { Append(targetGroup, symbols); } } } ); stringBuilder.Length--; }
public void Apply() { VREditor.SetVREnabledDevicesOnTargetGroup(targetGroup, devices); VREditor.SetVREnabledOnTargetGroup(targetGroup, enabled); PlayerSettings.stereoRenderingPath = stereoRenderingPath; }
public static void SetVirtualRealitySDKs(BuildTargetGroup targetGroup, string[] sdks) { VREditor.SetVirtualRealitySDKs(targetGroup, sdks); }
/// <summary> /// Set XRSettings:Turn On XRSettings,and List SDK As "None" First,"cardboard" Second /// </summary> /// <returns>return true if XRSetting right</returns> private static void SetXRSettings(BuildTargetGroup targetGroup) { VREditor.SetVREnabledOnTargetGroup(targetGroup, true); VREditor.SetVREnabledDevicesOnTargetGroup(targetGroup, VRDevice); }
bool IsOldVRSystemForCurrentBuildTargetGroupCorrect() => !VREditor.GetVREnabledOnTargetGroup(EditorUserBuildSettings.selectedBuildTargetGroup);
public static bool GetVirtualRealitySupported(BuildTargetGroup targetGroup) { return(VREditor.GetVREnabledOnTargetGroup(targetGroup)); }
public static void SetVirtualRealitySupported(BuildTargetGroup targetGroup, bool value) { VREditor.SetVREnabledOnTargetGroup(targetGroup, value); }
void FixVRSupportedForCurrentBuildTargetGroup() => VREditor.SetVREnabledOnTargetGroup(EditorUserBuildSettings.selectedBuildTargetGroup, true);
void FixOldVRSystemForCurrentBuildTargetGroup(bool fromAsyncUnused) => VREditor.SetVREnabledOnTargetGroup(EditorUserBuildSettings.selectedBuildTargetGroup, false);
public static string[] GetVirtualRealitySDKs(BuildTargetGroup targetGroup) { return(VREditor.GetVirtualRealitySDKs(targetGroup)); }