Forum Discussion

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

How To Get Leaderboard Working in Unreal Engine?

I'm using UE 4.26, and following the documentation here: https://developer.oculus.com/documentation/native/ps-leaderboards/

I set up the leaderboard on the app:

This is how I write to the leaderboard in BP:

This is how I read from the leaderboard in BP:

In game I see "Score Leaderboard Write Result: Success", so it seems the "Write Leaderboard Integer" node is returning success.

And if I stay in the game it seems to work as intended, it reads and displays that score. However, if I exit the game and restart it, it fails to find the score and shows 99999. If I go to my app dashboard and view entries for the leaderboard, it's empty:

How can I get the leaderboard working, and for scores to actually write to the leaderboard and persist outside of a single game run? I've tried on the alpha and release channels, but nothing seems to work. Please help.

  • Not sure if you're developing for Quest, but if you are then make sure that you've created and AndroidEngine.ini file under [ProjectDirectory]/Config/Android/

    Make sure that file contains the following lines:

    [OnlineSubsystem]
    DefaultPlatformService=Oculus

    Without that config file, I don't think that your quest app will use Oculus' online subsystem. I'm not entirely sure what the default online subsystem is, but it looks like it might be OnlineSubsystemNull. Peeking at the code it looks like WriteLeaderboardInteger will always return true when using OnlineSubsystemNull.

    Here's the url to the the quest platform development resource page:

    https://developer.oculus.com/documentation/unreal/ps-setup/


    Hope that helps.

2 Replies

Replies have been turned off for this discussion
  • ikoech's avatar
    ikoech
    Honored Guest

    Not sure if you're developing for Quest, but if you are then make sure that you've created and AndroidEngine.ini file under [ProjectDirectory]/Config/Android/

    Make sure that file contains the following lines:

    [OnlineSubsystem]
    DefaultPlatformService=Oculus

    Without that config file, I don't think that your quest app will use Oculus' online subsystem. I'm not entirely sure what the default online subsystem is, but it looks like it might be OnlineSubsystemNull. Peeking at the code it looks like WriteLeaderboardInteger will always return true when using OnlineSubsystemNull.

    Here's the url to the the quest platform development resource page:

    https://developer.oculus.com/documentation/unreal/ps-setup/


    Hope that helps.

    • faetell's avatar
      faetell
      Explorer

      You sir, are an absolute savior, thank you!

      I had been banging my head on this one for a long time.

      Indeed, missing the Oculus platform specification in AndroidEngine.ini was the problem. When I added that it worked!

      To be clear in case anyone else struggling with this finds this post, here's what I did:

      1. Use file explorer to navigate to: [ProjectDirectory]/Config/

      2. Create a new folder there called "Android" (if it doesn't exist)

      3. In that "Android" folder, create a file called "AndroidEngine.ini" (if it doesn't exist)

      4. In your editor of choice, add this content to the file:

      [OnlineSubsystem]
      DefaultPlatformService=Oculus

      I specific in such detail because at first I was trying to add Android/AndroidEngine.ini into the solution via visual studio under the Config folder there, and that did not work.