Unity C# API

Forum Listing » Game Achievements Forum » View Topic


  • Added this one to my site today:

    Current version v0.99:
    http://www.ashleygwinnell.co.uk/download/software/?id=10

    The only thing it lacks is a non-blocking mechanism -- I couldn't for the life of me get the keyword "yield" to work correctly. Anybody with more experience is welcome to edit the source and email me an update.

    Otherwise, post here for bugs and requests.

  • Thanks, I think I will use this!:D

     

  • Thanks, by the way.  Was able to integrate it with no major problems.

  • Actually, I was wondering if there was a way to add a high score to a specific high score table?  For example, if someone gets a score on easy mode, then it would go to the easy mode score table?

  • Is there some problem with the API when working in UNITY4 ?!?

    I tried to impelement it, and it works OK in every other distribution but not in the UNITY webplayer, and that was the one I wanted to use... !?! It kinda hangs up and does nothing until being aborted...This drives me crazy, it's not that hard, is it? Usually .... :(

    So I checked and it crashes when i try to VERIFY the USER... funny thing is it works in, for example, windows standalone mode... strange!

    Last edited on March 15, 2013 - 09:39 PM by to_be_deleted

  • Sooo... am I doing something wrong maybe, or is this a known issue ?!?

    Please help ! :)

  • I'm not sure. I imagine it crashes because it's not an asynchronous request? 

    https://twitter.com/DTwomey_ has been modifying my library recently (this might be fixed) and I'll see if he can upload it soon. 

  • Okay!

    Thanks for the reply, that sounds good ! :)

    EDIT :

    I checked the UNITY reference manual and it says under WWW.isdone()  :

    "You should not write loops that spin until download is done; use coroutines instead. An empty loop that waits for isDone will block in the web player. "

    I guess that's what happens... maybe I can even solve that myself (but probably not...). I'll let you know when/if I find something...

    EDIT:

    That is the problem, but I know far too little C# to do this ... :(

    LAST OF EDITS:

    So I got it to work now, you just have to get rid of the WHILE loop and wait for the result of the download somewhere else. I just split the functions on two parts : One makes the request for the URL, the other then interprets the result. Now you just make your program call the request, wait for the result, and then call the interpretation. I'm not posting any sources because I think what I did is not a very professional way to deal with this stuff, but I don't know better...

    Still, it works ! :)

     

     

    Last edited on March 21, 2013 - 10:24 AM by to_be_deleted

  •  I am curious on how you broke this down.  I see the problem you are talking about is in the openURLAndGetResponse function.  They are saying to use a coroutine which requires Monobehavior (and I tried to force a work around that just did not work).  I even tried to fake a coroutine and had no luck (making far for statements that would just do nothing but meaning computations and then keep checking back on it).  I also tried breaking it up but with other functions calling it as well I ended up breaking it far more than fixing it.

  • I seem to have the same problem. Anyone care to elaborate?

  • If I can figure it out, I will export the object I am using as a package (just an empty object with the script code) to help others out with this problem.  I am focusing on the trophies for this project (score was an irrelevant, moot idea IMO for this design) but if I get them working, tacking on the other details would not be too difficult.

  • There's a new version of the Unity C# API up on Bitbucket. https://bitbucket.org/Daniel_T/unity-gamejolt-api

    Post here if there are any bugs, and be sure to give https://twitter.com/DTwomey_ a tweet of thanks if this new version works out for you. :)

  • Great! cloning the API now and going to have a look at it - I'll let you know how it goes!

    Thanks!

  • I have been cranking at it constantly when not at work and find out I keep losing my verified status between loading levels (going from title screen to gameplay).  I've been trying everything I can think of (including even commenting out each of the this.verified = false; and still losing it).  I am able to get the trophies read (not checking on score or storage data because I am not using those) and even am able to read the status of the trophies and my account information as long as work from the title screen.  It has also been a hassle to work around the NullReference error that Unity loves to give.  The way I have done it is an empty object with just the script (and DontDestroyOnLoad(this.GameObject); in the Start() function).  When entering Gamplay, I am having the Game manager pull the script component out of the achievement manager and even look at the data inside of it (even able to call out each individual trophy from the from the GameManager and list it's ID, title, and status).    I have even tried loading the profile again when entering the gameplay out of desperation and that did not work because it would lose being verified (and gave it plenty of time to load, further than to load it initially).  Even tried commenting out the verification check and that just ended up driving it into the ground.

     

    I have everything else working and somehow ended up getting a trophy through but am currently stumped on this last hurdle.  Does anyone have any advice or workarounds?  I'm hoping to get around this and then I can export my Acheivement manager as a package so others can just grab it and put it into their game (it probably won't be clean but at least it will be able to help some who just want to import a package and work through it that way).

     

    PS,

    one change if you are get errors checking in your trophy.cs and using IsAchieved() and getting an error, quick change to fix it...

    if(this.getProperty("achieved") == "false")
    return false;
    else
    return true;

    will fix it (because if it is achieved, it does not return true but the time it was achieved and Boolean.Parse always had a fatal error with the returned result).

    Last edited on March 26, 2013 - 05:49 PM by NinRac

  • For now I am going to have to wrap this up as incomplete and put aside making it as a package to share to others on hold.  Myself and a couple other developers have tried to find a way to work around it and are unable to do so.  While stepping through the code, we find that there are two of it and whenever attempting to access the information it will come from a null because of the complications created from the instance.  This consistently results in the verification check to fail (and would result in verbose = false so you don't get your debug messages either).   Even trying to work around the instance has failed as Unity would not approve that way and instead would keep giving various errors.  A lot more work is going to need to be done and I think I will probably need to rewrite it up from scratch but I am having to get back to my projects and cannot do so at this time.  I am going to have to do that at a later time though.

    If anyone wants to handle it and make it into a package, you can contact me and I will share what I have learned in the process.    Gotta get back to my own things and not let down my team but would like to come back to this and get it working someday but I can't promise when.

Friends {{client.onlineFriendsCount}}/{{client.offlineFriendsCount}}

People Online:

Room Users {{client.usersOnline.length}}

: