Problem with achievements/leaderboards in Unity — Oculus
Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

Problem with achievements/leaderboards in Unity

aelita1992aelita1992 Posts: 10
NerveGear
edited August 2016 in Platform SDK Development
I'm havin a problem while trying to connect to Oculus's achievement/leaderboard api from Unity 5.4.0f3. I downloaded all the necessary packages and set up Oculus Platform settings. At the very beginning, when I start the game I'm getting

ScriptableObject.ctor is not allowed to be called from a ScriptableObject constructor (or instance field initializer), call it in OnEnable instead. Called from ScriptableObject 'OculusPlatformSettingsEditor'. from Platform Settings imported file and I'm not sure whether to make a workaround myself or if there's a simple solution for that one.

My second problem is that despite setting up a Leaderboard and some achievements in my project's site I can't do anything with them. When I'm calling Achievements.GetAllDefinitions().OnComplete(callbackMethod); for example, I'm getting null pointer from Achievements.GetAllDefinitions part and I can't do any further with that. I've spent a lot of time today trying to make all the set up steps from documentations and trying to make it work in any way but at the end of all that I'm still nowhere.

All help will be appreciated


Comments

  • brian_jewbrian_jew Posts: 62 Oculus Staff
    For the error: "ScriptableObject.ctor is not allowed to be called from a ScriptableObject constructor", do you have a stack trace?  It's usually printed out in the console log.

    If the initializing is failing then nothing else would be working which would explan why achievements isn't returning anything.
  • brian_jewbrian_jew Posts: 62 Oculus Staff
    Actually we found the problem for the first one you mentioned.  We'll have it fixed for the next release.  In the mean time, to unblock yourself, it's a one line fix:

    open OculusPlatformSettingsEditor.cs
    go to the constructor on line 32:

      OculusPlatformSettingsEditor()

    change it to the OnEnable() function:

      void OnEnable()

    that should fix the error.  Thanks for pointing this out to us!  Let us know if that helped.  
  • aelita1992aelita1992 Posts: 10
    NerveGear
    edited August 2016
    Wow! Great thanks man, that's why it wasn't working. Now both leaderboards and achievements work perfectly well. Thanks for help!
  • aelita1992aelita1992 Posts: 10
    NerveGear
    edited August 2016
    Stuck with yet another problem. I configured everything and the achievements/leaderboards are working for the generated token, work fine when I'm logged on my account on the android device. Now I'm trying to make it work for any account entitled for the app. I've uploaded a beta version of application and disabled the generated token from work, but the network stuff don't want to work properly.

    Edit: I think I narrowed the problem a little, but some questions have appeared. Does an app need to be present on the project's oculus page (I mean it's build) for achievements/leaderboards to work on android device?
  • aelita1992aelita1992 Posts: 10
    NerveGear
    Okay, posting the build to the build chanel and downloading the game via oculus app solved my problem :)
  • Swamp7hingSwamp7hing Posts: 37 Oculus Start Member
    Hey, is there any way you can give me a quick run down of the steps you took to implement leaderboards in your game? I've been struggling with it for a while and could use a bit of help!
  • @Swamp7hing : what problems are you running into?

  • aelita1992aelita1992 Posts: 10
    NerveGear
    Worry not, I helped Swamp using direct channel :) Should anyone need any help, feel free to PM me as well
Sign In or Register to comment.