Anyone using Parse? I’m trying to see if there is a way to check whether parse has been initialized so I don’t try to call parse methods and get an exception. ie: something like Parse.isInitialized or a event I can listen to?
Yes, I know that part, but what I’m trying to figure out is how to check if parse has been setup and is working. ie: once parse has been initialized (which can take time depending on internet connections, etc) I need to then submit a query right away to load my saved data. Or if for some reason parse was down/unable to connect then I need to check if it’s actually connected before making calls to it further in the game, or in testing lets say I’m in a scene where parse has not been initialized (because that object was in the main scene) then I need to know that it’s not initialized before trying to make calls.
I know this doesn’t exist, but is there anything like this I can check:
I’m having the same issue, using parse sdk 1.2.16… The best that I have found out is that if it hasn’t officially initialized you will get a Null Reference Error… (Kind of like the Facebook sdk, except the Parse SDK does NOT disable your script. That was a joy figure out…)
I placed the Parse InitializeBehaviour script at the very top of the execution order, placed my Parse Control script right after the facebook scripts/dll…
The way that I have met with some success is that I set the User to be ParseUser.CurrentUser, and then I check to see if the User has been authenticated by testing the .IsAuthenticated (bool variable) and branching off of that. Sadly, whoever wrote the documentation for Parse, much like the Documentation for the Facebook SDK, knew the SDK inside and out… and forgets that not everyone else knows it’s inner workings as well as they. I do not have a direct “do this” answer for you on this, and after a lot of searching, no one else does either. The best that I can say is that in a perfect world, the sdk will recognize the stored Current User, and will let you authenticate them using LoginAsync() with the
.ContinueWith (t =>… so that you can then check t.IsFaulted (error) or t.IsCanceled (the user backed out) then if need be, check t.Exception / t.Exception.InnerException to see what the heck went wrong.
Also, once you have Authenticated them, be sure to assign t.Result (the Authenticated version of the User) back to your ParseUser User… otherwise, it will still fail, and the darn thing will unload itself on you giving you a Null Reference Error (yet again).
It truly should not be this difficult. that is WHAT an SDK (Software Development Kit) is for – to make things easier… not harder.