简体   繁体   中英

Can't get the number of achievements from Unity game using Steamworks.NET

I was about to release a new game on Steam. It is a Unity game in which I use Steamworks.NET to get achievements from Steam.

I use the following code:

if (SteamManager.Initialized) {
    string name = SteamFriends.GetPersonaName ();
    Debug.Log (name+" - "+SteamUser.GetSteamID() );

    m_GameID = new CGameID (SteamUtils.GetAppID ());
    Debug.Log ("number of achievements: " + SteamUserStats.GetNumAchievements ());
    Debug.Log ("gameID: " + m_GameID);

} else {
    Debug.Log ("Steam not initialized");
}

m_GameID is set correctly (I use a steam_appid.txt file).

I use it for all my steam games, but for some reason SteamUserStats.GetNumAchievements () always returns 0.

I published the achievements on Steam, but still don't know why this is happening.

How I can correct that?

I discover the problem.

I just need to call SteamUserStats.RequestCurrentStats() in the update method. It's working now.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM