File tree Expand file tree Collapse file tree
Assets/HTC.UnityPlugin/ViveInputUtility/Scripts/Misc/OculusVRExtension Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,8 +42,7 @@ public class VIUOvrAvatar : MonoBehaviour
4242 // if true, manual update OVRInput if OVRManager not found
4343 [ SerializeField ]
4444 private bool manualUpdateOVRInput = true ;
45-
46- private bool visibilityChanged = true ;
45+ private static VIUOvrAvatar updateOvrInputUpdateInstance = null ;
4746
4847 public bool isAvatarReady { get ; private set ; }
4948 public IntPtr sdkAvatar { get ; private set ; }
@@ -114,7 +113,22 @@ private void Update()
114113
115114 if ( ShouldManuallyUpdateOVRInput )
116115 {
117- OVRInput . Update ( ) ;
116+ if ( updateOvrInputUpdateInstance == this )
117+ {
118+ OVRInput . Update ( ) ;
119+ }
120+ else if ( updateOvrInputUpdateInstance == null )
121+ {
122+ updateOvrInputUpdateInstance = this ;
123+ OVRInput . Update ( ) ;
124+ }
125+ }
126+ else
127+ {
128+ if ( updateOvrInputUpdateInstance == this )
129+ {
130+ updateOvrInputUpdateInstance = null ;
131+ }
118132 }
119133
120134 if ( ovrAvatarDriver != null )
@@ -124,9 +138,17 @@ private void Update()
124138 }
125139 }
126140
141+ private void OnDisable ( )
142+ {
143+ if ( updateOvrInputUpdateInstance == this )
144+ {
145+ updateOvrInputUpdateInstance = null ;
146+ }
147+ }
148+
127149 private void FixedUpdate ( )
128150 {
129- if ( ShouldManuallyUpdateOVRInput )
151+ if ( ShouldManuallyUpdateOVRInput && updateOvrInputUpdateInstance == this )
130152 {
131153 OVRInput . FixedUpdate ( ) ;
132154 }
You can’t perform that action at this time.
0 commit comments