66using System . IO ;
77using System ;
88using System . Linq ;
9+ using System . Text ;
910
1011#if UNITY_XR_MANAGEMENT
1112using 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