Forum Discussion

🚨 This forum is archived and read-only. To submit a forum post, please visit our new Developer Forum. 🚨
Anonymous's avatar
Anonymous
4 years ago
Solved

How to detect when guardian changes from Unity?

Hi,

 

I'm developing a roomscale game and I use OVRManager.boundary.GetGeometry(OVRBoundary.BoundaryType.OuterBoundary) to create a custom in-game visible boundary so that the player can align their playspace to the in-game playspace as they like. As part of this process they may decide to update their guardian, but then the geometry I previously fetched is out of date. One way to solve this would be to have an in-game way for the player to reset the in-game boundary and I would then just refetch the boundary. However, I'd prefer to automatically detect any change. I can't for the life of me find an efficient way to do this or any events.

 

My other thought is to just re-fetch and re-build the in-game boundary every couple of seconds but that also feels a bit lame 🙂

 

Help!

  • Anonymous's avatar
    Anonymous
    4 years ago

    To adjust the guardian the running application has to lose input focus. I think you could just verify the boundary every time the application gains input focus?

     

    public class FocusTest : MonoBehaviour {
        private void Awake() {
            OVRManager.InputFocusAcquired += OnInputFocusAcquired;
        }
    
        private void OnDestroy() {
            OVRManager.InputFocusAcquired -= OnInputFocusAcquired;
        }
    
        private void OnInputFocusAcquired() {
            Debug.Log("Verify boundary.");
        }
    
        private void OnApplicationFocus(bool hasFocus) {
            if (hasFocus) {
                Debug.Log("This might work too.");
            }
        }
    }

2 Replies

Replies have been turned off for this discussion
  • Anonymous's avatar
    Anonymous

    To adjust the guardian the running application has to lose input focus. I think you could just verify the boundary every time the application gains input focus?

     

    public class FocusTest : MonoBehaviour {
        private void Awake() {
            OVRManager.InputFocusAcquired += OnInputFocusAcquired;
        }
    
        private void OnDestroy() {
            OVRManager.InputFocusAcquired -= OnInputFocusAcquired;
        }
    
        private void OnInputFocusAcquired() {
            Debug.Log("Verify boundary.");
        }
    
        private void OnApplicationFocus(bool hasFocus) {
            if (hasFocus) {
                Debug.Log("This might work too.");
            }
        }
    }
    • Anonymous's avatar
      Anonymous

      Thank you so much! I'm pretty new to all of this and that's a wonderful solution. You totally made my day, thanks!! 🙂