Skip to content

Commit 3aa1726

Browse files
committed
v1.1.6 - Fix for unity projects set to binary serialization
1 parent 8ada8f7 commit 3aa1726

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

com.valve.openvr/Editor/OpenVRSettingsCopier.cs

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
using System.IO;
77
using System;
88
using System.Linq;
9+
using System.Text;
910

1011
#if UNITY_XR_MANAGEMENT
1112
using UnityEngine.XR;
@@ -96,7 +97,6 @@ public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProj
9697

9798
Debug.Log("settingsAssetPath: " + settingsAssetPath);
9899

99-
FileInfo currentSettingsPath = new FileInfo(settingsAssetPath);
100100
FileInfo newSettingsPath = new FileInfo(Path.Combine(streamingSteamVR, "OpenVRSettings.asset"));
101101

102102
if (newSettingsPath.Exists)
@@ -105,9 +105,23 @@ public static void OnPostprocessBuild(BuildTarget target, string pathToBuiltProj
105105
newSettingsPath.Delete();
106106
}
107107

108-
File.Copy(currentSettingsPath.FullName, newSettingsPath.FullName);
108+
//File.Copy(currentSettingsPath.FullName, newSettingsPath.FullName);
109+
File.WriteAllText(newSettingsPath.FullName, CreateSettingText());
110+
Debug.Log("Wrote openvr settings to build directory: " + newSettingsPath.FullName);
111+
//Debug.Log("Copied openvr settings to build directory: " + newSettingsPath.FullName);
112+
}
113+
109114

110-
Debug.Log("Copied openvr settings to build directory: " + newSettingsPath.FullName);
115+
private static string CreateSettingText()
116+
{
117+
OpenVRSettings settings = OpenVRSettings.GetSettings();
118+
StringBuilder text = new StringBuilder();
119+
text.AppendLine("StereoRenderingMode: " + (int)settings.StereoRenderingMode);
120+
text.AppendLine("InitializationType: " + (int)settings.InitializationType);
121+
text.AppendLine("EditorAppKey: " + settings.EditorAppKey);
122+
text.AppendLine("ActionManifestFileRelativeFilePath: " + settings.ActionManifestFileRelativeFilePath);
123+
text.AppendLine("MirrorView: " + (int)settings.MirrorView);
124+
return text.ToString();
111125
}
112126
}
113127
}

0 commit comments

Comments
 (0)