Skip to content

Commit 890af12

Browse files
author
lawwong
committed
Avoid initiaing ViveInput in Awake or OnValidate
1 parent dbd88e5 commit 890af12

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Assets/HTC.UnityPlugin/ViveInputUtility/Scripts/ViveInput/ViveInputVirtualButton.cs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,12 @@ private void Reset()
103103
});
104104
}
105105
#endif
106-
106+
[RuntimeInitializeOnLoadMethod]
107+
private static void InitializeViveInput()
108+
{
109+
ViveInput.Initialize();
110+
}
111+
107112
private void Awake()
108113
{
109114
TryListenUpdateEvent();
@@ -116,7 +121,6 @@ private void TryListenUpdateEvent()
116121
// register update event
117122
ViveInput.onUpdate += OnInputStateUpdated;
118123
m_updateActivated = true;
119-
ViveInput.Initialize();
120124
}
121125
}
122126

0 commit comments

Comments
 (0)