Created
April 8, 2019 06:02
-
-
Save suzumura-ss/97df5a6d37e237bdce6f21cd0ff9039e to your computer and use it in GitHub Desktop.
SteamVR Plugin v1.2.3 patch for Unity 2018.3.X
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Assets/SteamVR/Editor/SteamVR_Settings.cs b/Assets/SteamVR/Editor/SteamVR_Settings.cs | |
index f6e8145..9091be4 100644 | |
--- a/Assets/SteamVR/Editor/SteamVR_Settings.cs | |
+++ b/Assets/SteamVR/Editor/SteamVR_Settings.cs | |
@@ -19,7 +19,6 @@ public class SteamVR_Settings : EditorWindow | |
const string buildTarget = "Build Target"; | |
const string showUnitySplashScreen = "Show Unity Splashscreen"; | |
- const string defaultIsFullScreen = "Default is Fullscreen"; | |
const string defaultScreenSize = "Default Screen Size"; | |
const string runInBackground = "Run In Background"; | |
const string displayResolutionDialog = "Display Resolution Dialog"; | |
@@ -37,13 +36,12 @@ public class SteamVR_Settings : EditorWindow | |
const BuildTarget recommended_BuildTarget = BuildTarget.StandaloneWindows64; | |
const bool recommended_ShowUnitySplashScreen = false; | |
- const bool recommended_DefaultIsFullScreen = false; | |
const int recommended_DefaultScreenWidth = 1024; | |
const int recommended_DefaultScreenHeight = 768; | |
const bool recommended_RunInBackground = true; | |
const ResolutionDialogSetting recommended_DisplayResolutionDialog = ResolutionDialogSetting.HiddenByDefault; | |
const bool recommended_ResizableWindow = true; | |
- const D3D11FullscreenMode recommended_FullscreenMode = D3D11FullscreenMode.FullscreenWindow; | |
+ const FullScreenMode recommended_FullscreenMode = FullScreenMode.FullScreenWindow; | |
const bool recommended_VisibleInBackground = true; | |
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) | |
const RenderingPath recommended_RenderPath = RenderingPath.Forward; | |
@@ -72,8 +70,6 @@ public class SteamVR_Settings : EditorWindow | |
#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)) || | |
@@ -84,7 +80,7 @@ public class SteamVR_Settings : EditorWindow | |
(!EditorPrefs.HasKey(ignore + resizableWindow) && | |
PlayerSettings.resizableWindow != recommended_ResizableWindow) || | |
(!EditorPrefs.HasKey(ignore + fullscreenMode) && | |
- PlayerSettings.d3d11FullscreenMode != recommended_FullscreenMode) || | |
+ PlayerSettings.fullScreenMode != 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) | |
@@ -179,7 +175,7 @@ public class SteamVR_Settings : EditorWindow | |
} | |
Vector2 scrollPosition; | |
- | |
+ | |
string GetResourcePath() | |
{ | |
var ms = MonoScript.FromScriptableObject(this); | |
@@ -279,29 +275,6 @@ public class SteamVR_Settings : EditorWindow | |
GUILayout.EndHorizontal(); | |
} | |
#endif | |
- if (!EditorPrefs.HasKey(ignore + defaultIsFullScreen) && | |
- PlayerSettings.defaultIsFullScreen != recommended_DefaultIsFullScreen) | |
- { | |
- ++numItems; | |
- | |
- GUILayout.Label(defaultIsFullScreen + string.Format(currentValue, PlayerSettings.defaultIsFullScreen)); | |
- | |
- GUILayout.BeginHorizontal(); | |
- | |
- if (GUILayout.Button(string.Format(useRecommended, recommended_DefaultIsFullScreen))) | |
- { | |
- PlayerSettings.defaultIsFullScreen = recommended_DefaultIsFullScreen; | |
- } | |
- | |
- GUILayout.FlexibleSpace(); | |
- | |
- if (GUILayout.Button("Ignore")) | |
- { | |
- EditorPrefs.SetBool(ignore + defaultIsFullScreen, true); | |
- } | |
- | |
- GUILayout.EndHorizontal(); | |
- } | |
if (!EditorPrefs.HasKey(ignore + defaultScreenSize) && | |
(PlayerSettings.defaultScreenWidth != recommended_DefaultScreenWidth || | |
@@ -402,17 +375,17 @@ public class SteamVR_Settings : EditorWindow | |
} | |
if (!EditorPrefs.HasKey(ignore + fullscreenMode) && | |
- PlayerSettings.d3d11FullscreenMode != recommended_FullscreenMode) | |
+ PlayerSettings.fullScreenMode != recommended_FullscreenMode) | |
{ | |
++numItems; | |
- GUILayout.Label(fullscreenMode + string.Format(currentValue, PlayerSettings.d3d11FullscreenMode)); | |
+ GUILayout.Label(fullscreenMode + string.Format(currentValue, PlayerSettings.fullScreenMode)); | |
GUILayout.BeginHorizontal(); | |
if (GUILayout.Button(string.Format(useRecommended, recommended_FullscreenMode))) | |
{ | |
- PlayerSettings.d3d11FullscreenMode = recommended_FullscreenMode; | |
+ PlayerSettings.fullScreenMode = recommended_FullscreenMode; | |
} | |
GUILayout.FlexibleSpace(); | |
@@ -555,7 +528,6 @@ public class SteamVR_Settings : EditorWindow | |
{ | |
EditorPrefs.DeleteKey(ignore + buildTarget); | |
EditorPrefs.DeleteKey(ignore + showUnitySplashScreen); | |
- EditorPrefs.DeleteKey(ignore + defaultIsFullScreen); | |
EditorPrefs.DeleteKey(ignore + defaultScreenSize); | |
EditorPrefs.DeleteKey(ignore + runInBackground); | |
EditorPrefs.DeleteKey(ignore + displayResolutionDialog); | |
@@ -597,8 +569,6 @@ public class SteamVR_Settings : EditorWindow | |
#else | |
PlayerSettings.SplashScreen.show = recommended_ShowUnitySplashScreen; | |
#endif | |
- if (!EditorPrefs.HasKey(ignore + defaultIsFullScreen)) | |
- PlayerSettings.defaultIsFullScreen = recommended_DefaultIsFullScreen; | |
if (!EditorPrefs.HasKey(ignore + defaultScreenSize)) | |
{ | |
PlayerSettings.defaultScreenWidth = recommended_DefaultScreenWidth; | |
@@ -611,7 +581,7 @@ public class SteamVR_Settings : EditorWindow | |
if (!EditorPrefs.HasKey(ignore + resizableWindow)) | |
PlayerSettings.resizableWindow = recommended_ResizableWindow; | |
if (!EditorPrefs.HasKey(ignore + fullscreenMode)) | |
- PlayerSettings.d3d11FullscreenMode = recommended_FullscreenMode; | |
+ PlayerSettings.fullScreenMode = recommended_FullscreenMode; | |
if (!EditorPrefs.HasKey(ignore + visibleInBackground)) | |
PlayerSettings.visibleInBackground = recommended_VisibleInBackground; | |
#if (UNITY_5_4 || UNITY_5_3 || UNITY_5_2 || UNITY_5_1 || UNITY_5_0) | |
@@ -645,8 +615,6 @@ public class SteamVR_Settings : EditorWindow | |
if (PlayerSettings.SplashScreen.show != recommended_ShowUnitySplashScreen) | |
#endif | |
EditorPrefs.SetBool(ignore + showUnitySplashScreen, true); | |
- if (PlayerSettings.defaultIsFullScreen != recommended_DefaultIsFullScreen) | |
- EditorPrefs.SetBool(ignore + defaultIsFullScreen, true); | |
if (PlayerSettings.defaultScreenWidth != recommended_DefaultScreenWidth || | |
PlayerSettings.defaultScreenHeight != recommended_DefaultScreenHeight) | |
EditorPrefs.SetBool(ignore + defaultScreenSize, true); | |
@@ -656,7 +624,7 @@ public class SteamVR_Settings : EditorWindow | |
EditorPrefs.SetBool(ignore + displayResolutionDialog, true); | |
if (PlayerSettings.resizableWindow != recommended_ResizableWindow) | |
EditorPrefs.SetBool(ignore + resizableWindow, true); | |
- if (PlayerSettings.d3d11FullscreenMode != recommended_FullscreenMode) | |
+ if (PlayerSettings.fullScreenMode != recommended_FullscreenMode) | |
EditorPrefs.SetBool(ignore + fullscreenMode, true); | |
if (PlayerSettings.visibleInBackground != recommended_VisibleInBackground) | |
EditorPrefs.SetBool(ignore + visibleInBackground, true); | |
diff --git a/Assets/SteamVR/Editor/SteamVR_Update.cs b/Assets/SteamVR/Editor/SteamVR_Update.cs | |
index 51e65cf..80abe40 100644 | |
--- a/Assets/SteamVR/Editor/SteamVR_Update.cs | |
+++ b/Assets/SteamVR/Editor/SteamVR_Update.cs | |
@@ -8,6 +8,7 @@ using UnityEngine; | |
using UnityEditor; | |
using System.IO; | |
using System.Text.RegularExpressions; | |
+using UnityEngine.Networking; | |
[InitializeOnLoad] | |
public class SteamVR_Update : EditorWindow | |
@@ -19,7 +20,7 @@ public class SteamVR_Update : EditorWindow | |
const string doNotShowKey = "SteamVR.DoNotShow.v{0}"; | |
static bool gotVersion = false; | |
- static WWW wwwVersion, wwwNotes; | |
+ static UnityWebRequest wwwVersion, wwwNotes; | |
static string version, notes; | |
static SteamVR_Update window; | |
@@ -33,13 +34,17 @@ public class SteamVR_Update : EditorWindow | |
if (!gotVersion) | |
{ | |
if (wwwVersion == null) | |
- wwwVersion = new WWW(versionUrl); | |
+ { | |
+ wwwVersion = UnityWebRequest.Get(versionUrl); | |
+ wwwVersion.downloadHandler = new DownloadHandlerBuffer(); | |
+ wwwVersion.SendWebRequest(); | |
+ } | |
if (!wwwVersion.isDone) | |
return; | |
if (UrlSuccess(wwwVersion)) | |
- version = wwwVersion.text; | |
+ version = wwwVersion.downloadHandler.text; | |
wwwVersion = null; | |
gotVersion = true; | |
@@ -47,7 +52,9 @@ public class SteamVR_Update : EditorWindow | |
if (ShouldDisplay()) | |
{ | |
var url = string.Format(notesUrl, version); | |
- wwwNotes = new WWW(url); | |
+ wwwNotes = UnityWebRequest.Get(url); | |
+ wwwNotes.downloadHandler = new DownloadHandlerBuffer(); | |
+ wwwNotes.SendWebRequest(); | |
window = GetWindow<SteamVR_Update>(true); | |
window.minSize = new Vector2(320, 440); | |
@@ -61,7 +68,7 @@ public class SteamVR_Update : EditorWindow | |
return; | |
if (UrlSuccess(wwwNotes)) | |
- notes = wwwNotes.text; | |
+ notes = wwwNotes.downloadHandler.text; | |
wwwNotes = null; | |
@@ -72,11 +79,11 @@ public class SteamVR_Update : EditorWindow | |
EditorApplication.update -= Update; | |
} | |
- static bool UrlSuccess(WWW www) | |
+ static bool UrlSuccess(UnityWebRequest req) | |
{ | |
- if (!string.IsNullOrEmpty(www.error)) | |
+ if (!string.IsNullOrEmpty(req.error)) | |
return false; | |
- if (Regex.IsMatch(www.text, "404 not found", RegexOptions.IgnoreCase)) | |
+ if (Regex.IsMatch(req.downloadHandler.text, "404 not found", RegexOptions.IgnoreCase)) | |
return false; | |
return true; | |
} | |
diff --git a/Assets/SteamVR/Scripts/SteamVR.cs b/Assets/SteamVR/Scripts/SteamVR.cs | |
index ee976ef..886285a 100644 | |
--- a/Assets/SteamVR/Scripts/SteamVR.cs | |
+++ b/Assets/SteamVR/Scripts/SteamVR.cs | |
@@ -19,7 +19,7 @@ public class SteamVR : System.IDisposable | |
{ | |
get | |
{ | |
- if (!UnityEngine.VR.VRSettings.enabled) | |
+ if (!UnityEngine.XR.XRSettings.enabled) | |
enabled = false; | |
return _enabled; | |
} | |
@@ -58,7 +58,7 @@ public class SteamVR : System.IDisposable | |
public static bool usingNativeSupport | |
{ | |
- get { return UnityEngine.VR.VRDevice.GetNativePtr() != System.IntPtr.Zero; } | |
+ get { return UnityEngine.XR.XRDevice.GetNativePtr() != System.IntPtr.Zero; } | |
} | |
static SteamVR CreateInstance() | |
diff --git a/Assets/SteamVR/Scripts/SteamVR_Camera.cs b/Assets/SteamVR/Scripts/SteamVR_Camera.cs | |
index 5f14741..26e338e 100644 | |
--- a/Assets/SteamVR/Scripts/SteamVR_Camera.cs | |
+++ b/Assets/SteamVR/Scripts/SteamVR_Camera.cs | |
@@ -33,8 +33,8 @@ public class SteamVR_Camera : MonoBehaviour | |
static public float sceneResolutionScale | |
{ | |
- get { return UnityEngine.VR.VRSettings.renderScale; } | |
- set { UnityEngine.VR.VRSettings.renderScale = value; } | |
+ get { return UnityEngine.XR.XRSettings.eyeTextureResolutionScale; } | |
+ set { UnityEngine.XR.XRSettings.eyeTextureResolutionScale = value; } | |
} | |
#region Enable / Disable |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment