/
SteamVR_Settings.cs
75 lines (61 loc) · 2.39 KB
/
SteamVR_Settings.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
using UnityEngine;
using System.Collections;
public class SteamVR_Settings : ScriptableObject
{
private static SteamVR_Settings _instance;
public static SteamVR_Settings instance
{
get
{
LoadInstance();
return _instance;
}
}
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
}
}
}
public bool pauseGameWhenDashboardVisible = true;
public bool lockPhysicsUpdateRateToRenderFrequency = true;
public Valve.VR.ETrackingUniverseOrigin trackingSpace = Valve.VR.ETrackingUniverseOrigin.TrackingUniverseStanding;
[Tooltip("Filename local to the project root (or executable, in a build)")]
public string actionsFilePath = "actions.json";
public SteamVR_UpdateModes inputUpdateMode = SteamVR_UpdateModes.OnUpdate;
public SteamVR_UpdateModes poseUpdateMode = SteamVR_UpdateModes.OnPreCull;
public bool activateFirstActionSetOnStart = true;
public string appKey;
public bool IsInputUpdateMode(SteamVR_UpdateModes tocheck)
{
return (inputUpdateMode & tocheck) == inputUpdateMode;
}
public bool IsPoseUpdateMode(SteamVR_UpdateModes tocheck)
{
return (poseUpdateMode & tocheck) == poseUpdateMode;
}
public static void VerifyScriptableObject()
{
LoadInstance();
}
}