Skip to main content
Up and Coming
September 30, 2016

Universal menu integration

We are building a Rift game and found that we need to integrate it with the UM.

How can we know when the UM is active?

And how can we know if the user selected the Recenter App option?

Thanks
Andres
    This topic has been closed for replies.

    21 replies

    baknoAuthor
    Up and Coming
    October 6, 2016
    Hi @vrdaveb,

    The project has the 
    Run in Background option selected.

    We use a Console script with which we can Log into the regular display.

    Now we are using your 
    EventTester script and it does not log any event.

    We added the following:

    void OnApplicationFocus() {
         Log("OnApplicationFocus");
    }

    And it does log when we switch to another application and back to the game.

    Maybe the problem is related to the way we have integrated the OVR Plugin. Can you please provide a list of the minimum scripts necessary from the Unity Utilities?

    Thank you
    Andres
    baknoAuthor
    Up and Coming
    October 6, 2016
    Got it. At least for VrFocus. It was necessary to place the OVRManager script into an object.

    We don't use the Camera Rig prefab since Unity's regular camera works fine. Is it absolutely necessary?

    It is confusing. Unity says that for Unity5.4 it is not necessary to import the Oculus Utilities. But in order to be able to detect when the UM is active, it is necessary. Can you please clarify?

    Regards
    Andres
    Inspiring
    October 6, 2016
    Hi again,

    I must have something wrong here, as My environment (Visual Studio 14) doesn't recognice some of those events (see red underlines):



    So I commented out those lines and run the game (from Unity), and the output was (sorry for the image instead of a .txt file, but I couldn't copy-paste the output and couldn't find any file or how to save it to file...):



    WHAT I DID WAS:

    1) Until the first TrackingAquired was the normal behabiour.
    2) Then I went to Universal Menu, hit recenter, and press A button: Nothing happened, nothing logged.
    3) Then I pressed my manual recenter button ("back"), and then yes, I got the recenter, and the logging of the second TrackingAcquired, the RecenterPose, and the other message (which is just mine, custom message).
    4) Quit the application, and the last message was logged.

    Something is obviously wrong here, as I should recognice those lines without errors, right? I'm using a DK2 for the PC, but that shouldn't affect the events. Should I reinstall Unity with a clean version of the unitypackage? I did an upgrade some time ago of the OVR package, overwriting the files (I didn't like it much that procedure BTW).

    Thanks very much for the support!

    baknoAuthor
    Up and Coming
    October 6, 2016
    Is there anyway to write the following statement in Javascript?...
    OVRManager.VrFocusAcquired += () => Debug.Log("VrFocusAcquired");

    baknoAuthor
    Up and Coming
    October 6, 2016
    Got it...   https://unity3d.com/learn/tutorials/topics/scripting/events
    baknoAuthor
    Up and Coming
    October 6, 2016
    According to Oculus documentation. It is necessary to initialize the game using the appID, and the following code:

    Oculus.Platform.Core.Initialize(appID)

    But Unity does not recognize such code. Oculus documentation seems to be well organized, but these simple things are not well documented.

    How can we initialize our game with the appID?
    Inspiring
    October 7, 2016

    bakno said:

    According to Oculus documentation. It is necessary to initialize the game using the appID, and the following code:

    Oculus.Platform.Core.Initialize(appID)


    Hi @bakno , that code is to initialize the Oculus SDK Platform, which is not the same as the Oculus Utilities (OVR plugin) for integration with Unity.

    I'm using both, and the line to initialize the Platform SDK is just:

    Oculus.Platform.Core.Initialize("xxxxxxxxxxxxxxx");
    You can find your AppId in the Developer Dashboard, in your App view, in the API tab.

    But perhaps you just don't need that!
    Basically:
    • Oculus Utilities for Unity 5 (OVR plugin package): to integrate Oculus in Unity (OVRManager, OVRCameraRig, etc.)
    • Oculus Platform SDK: to implement things like global scoreboards, achievement, app entitlement, etc.

    Inspiring
    October 7, 2016
    @moodleman, you are on Utilities 1.3.0. Can you update to 1.8.0?
    baknoAuthor
    Up and Coming
    October 7, 2016
    Thank you @moodleman. I found about the Oculus Platform SDK yesterday night.

    And I was able to code the initialization without errors. 

    Now I need to make sure the app provides entitlement check. According to Oculus documentation, I need to run something like this:

    Entitlements.IsUserEntitledToApplication().OnComplete( (Message msg) => {code} );

    But I need to do the same in Javascript. Does anyone know how to do the same in Javascript?
    Inspiring
    October 7, 2016
    Hi, yes, of course, I upgraded it a time ago, I didn't know it was so obsolete by now! I'll do it and report again, thanks!

    The process is too manual and ugly BTW, and I have a prefab with a modified OVRCameraRig, I hope to not have many issues... let's see :-/