code-disaster / steamworks4j

A thin Java wrapper to access the Steamworks API
https://code-disaster.github.io/steamworks4j/
MIT License
479 stars 67 forks source link

Achievements only run when app closes #88

Closed kennycason closed 4 years ago

kennycason commented 4 years ago

I'm trying to make it so that achievements pop up as a player unlocks them. Currently the achievements only pop up once the game is closed. Is this possible?

Thanks for the library, it's been very easy to get running.

cairn4 commented 4 years ago

I've been working on setting up achievements in my libgdx game, and was noticing the same behavior. Then I realized that I'm not actually able to bring up the SteamOverlay while the game is running via Android Studio (but it does work when running the game from the Steam client) - might be related to the achievement notifications not showing up?

LobbyDivinus commented 4 years ago

I experienced the same issue and was able to solve it by calling

steamUserStats.storeStats();

right after setting the achievement. It's also documented somewhere in Valve's documentation pages :)

@cairn4 Did you set up the steam_appid.txt that contains the app id of your app in the assets folder?

Superwutz commented 4 years ago

I had the same problam and can confirm, that @LobbyDivinus soloution is working!

kennycason commented 4 years ago

@LobbyDivinus @Superwutz thanks a lot for the response + confirmation. I'll give it a shot!

code-disaster commented 4 years ago

Yes, without calling storeStats() the Steam client just caches your achievement updates, and triggers all popups on exit.