cancel
Showing results for 
Search instead for 
Did you mean: 

How to detect when guardian changes from Unity?

damondium
Level 3

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!

1 ACCEPTED SOLUTION

Accepted Solutions

DarkTable
Level 7

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.");
        }
    }
}

View solution in original post

2 REPLIES 2

DarkTable
Level 7

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.");
        }
    }
}

View solution in original post

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