loicteixeira / gj-unity-api

[MOVED] Game Jolt API wrapper for Unity.
https://github.com/InfectedBytes/gj-unity-api/
MIT License
16 stars 13 forks source link

Login is failing after Unity update #73

Closed loicteixeira closed 7 years ago

loicteixeira commented 7 years ago

Trying to log via the UI will display Wrong username and/or token. (see video).

Unity v2017.1.0b5, GJAPI v2.1.2.

loicteixeira commented 7 years ago

Technically the window will show the Wrong username and/or token. message, regardless of the error.

One way to learn a bit more about the underlying issue, would be to replace this with:

if (response.success)
{
    Manager.Instance.CurrentUser = this;
    Get();
}
else
{
    Debug.Log(response.json);
}

Edit: Actually, upon closer inspection, if the call isn't successful, it should already print the message to the console so the error might not be on the server but somewhere else in the code.

TheFossett commented 7 years ago

There is another problem where sometimes you are able to upload a guest score to the first leaderboard you made but it doesn't work 100% of the time. This problem could still tie in with the current problem not to sure :/

Hope this helps :) Spencer Fossett

DanielJMus commented 7 years ago

Hey lads, I just fixed this.

I noticed that the Debug.LogError for the www.error was a blank message, upon reading the documentation for Www.error I noticed that they pointed this out.

In Response.cs at line 83, simply change:

if (www.error != null)

at the top of the Response function to:

if (www.error != null && !string.IsNullOrEmpty(www.error))

Hope this helps out, I haven't used Github before so I'm not too sure how to use it, so hopefully this comment will help others out and get passed on to be fixed in the source code.

loicteixeira commented 7 years ago

Hi @DanielJMus, thanks for your help and detailed explanation.

If you're interested in learning more about Git, GitHub and open source contribution, feel free to follow this guide to submit a fix (you can skip Submit a feature proposal and stop after Submit a pull request (PR)). Basically you make a copy of this repository under your own account (so you have write rights), make a fix and then request me to pull your fix into my repository.

No pressure though, I'm happy to do it myself and include this in the next patch.

DanielJMus commented 7 years ago

Thanks @loicteixeira, I created a pull request, and thank you for the guide!

mgeorgedeveloper commented 7 years ago

if (!string.IsNullOrEmpty(www.error)) will work OK. No need for the extra null check before string.IsNullOrEmpty.

loicteixeira commented 7 years ago

Thanks @DanielJMus for the contribution (I'll merge it next week) and thanks @mgeorgedeveloper for the very pertinent suggestion (I'll update the code accordingly)!

Edit: PR #74