public static GetResourcesFolderPath ( bool fromAssetsDirectory = false ) : string | ||
fromAssetsDirectory | bool | |
return | string |
private static void LoadInstance() { if (_instance == null) { _instance = Resources.Load <SteamVR_Settings>("SteamVR_Settings"); if (_instance == null) { _instance = SteamVR_Settings.CreateInstance <SteamVR_Settings>(); #if UNITY_EDITOR string folderPath = SteamVR.GetResourcesFolderPath(true); string assetPath = System.IO.Path.Combine(folderPath, "SteamVR_Settings.asset"); UnityEditor.AssetDatabase.CreateAsset(_instance, assetPath); UnityEditor.AssetDatabase.SaveAssets(); #endif } if (string.IsNullOrEmpty(_instance.appKey)) { _instance.appKey = SteamVR.GenerateAppKey(); Debug.Log("[SteamVR] Generated you an app key of: " + _instance.appKey + ". This can be changed in Assets/SteamVR/Resources/SteamVR_Settings"); #if UNITY_EDITOR UnityEditor.EditorUtility.SetDirty(_instance); UnityEditor.AssetDatabase.SaveAssets(); #endif } } }
private static void LoadInstance() { if (_instance == null) { _instance = Resources.Load <SteamVR_Settings>("SteamVR_Settings"); if (_instance == null) { _instance = SteamVR_Settings.CreateInstance <SteamVR_Settings>(); #if UNITY_EDITOR string folderPath = SteamVR.GetResourcesFolderPath(true); if (!System.IO.Directory.Exists(folderPath)) { Debug.LogWarning($"<b>[SteamVR]</b> Path '{folderPath}' did not exist; creating ..."); System.IO.Directory.CreateDirectory(folderPath); } string assetPath = System.IO.Path.Combine(folderPath, "SteamVR_Settings.asset"); UnityEditor.AssetDatabase.CreateAsset(_instance, assetPath); UnityEditor.AssetDatabase.SaveAssets(); #endif } if (string.IsNullOrEmpty(_instance.editorAppKey)) { _instance.editorAppKey = SteamVR.GenerateAppKey(); Debug.Log("<b>[SteamVR Setup]</b> Generated you an editor app key of: " + _instance.editorAppKey + ". This lets the editor tell SteamVR what project this is. Has no effect on builds. This can be changed in Assets/SteamVR/Resources/SteamVR_Settings"); #if UNITY_EDITOR UnityEditor.EditorUtility.SetDirty(_instance); UnityEditor.AssetDatabase.SaveAssets(); #endif } } }