3
\$\begingroup\$

I'm using Facepunch.Steamworks (https://github.com/Facepunch/Facepunch.Steamworks) to connect my Unity game to Steam. The login seems to work fine. The board object is an FP class, and AddScore is a call to the library to send the score to Steam.

I have the boards set up on Steam, and they come out with IsValid == true. Here are the output and the code. The boards currently have no data in them, so I don't think it's because the score isn't beating an existing one.

xxxxxxxx
Standard-Normal
True
Fail
public void SubmitScore(Globals.ApplicationMode mode, Globals.SkillLevels skillLevel, int score)
{
    int index = GetLeaderboardIndex(mode, skillLevel);
    if(index == -1 || !IsSteamPlatform())
    {
        return;
    }
    Leaderboard board = m_leaderboards[index];
    Debug.Log("xxxxxxxx");
    Debug.Log(board.Name);
    Debug.Log(board.IsValid);
    board.AddScore(true, score, null, AddScoreSuccessCallback, AddScoreFailureCallback);
}

private void AddScoreSuccessCallback(Leaderboard.AddScoreResult result)
{
    Debug.Log(result.Score);
}

private void AddScoreFailureCallback(Facepunch.Steamworks.Callbacks.Result result)
{
    Debug.Log(result.ToString());
}

Here's a shot of the leaderboards on the Steam control panel. They seem in order; their "Writes" attributes are false so that the client can submit to them directly.

enter image description here

\$\endgroup\$
2
  • \$\begingroup\$ Have you tried it with board.AddScore(false, ...) ? From the documentation, it looks like as long as that's true, it will fail if it doesn't beat an existing score. Not having a score may be the problem depending on how they implemented that condition. \$\endgroup\$
    – Stephan
    Commented Dec 11, 2017 at 21:46
  • \$\begingroup\$ Good idea; didn't seem to change anything. I reverified that the board is ok; I tried getting it from Steam with the wrong name, and got a null board, as expected. There's a slight delay before it prints "Fail", so I'm pretty sure it's hitting the server. I've added a shot of the Steam tables; they also appear to be configured correctly. \$\endgroup\$
    – Almo
    Commented Dec 12, 2017 at 7:32

1 Answer 1

1
\$\begingroup\$

Must fetch the scores before you can submit.

foreach(Leaderboard board in m_leaderboards)
{
    board.FetchScores(Leaderboard.RequestType.Global, 0, 10);
}

After executing the above code, submissions work fine.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .