How to get how many hours has users spent playing my game? Steamworks API

佐手、 提交于 2019-12-11 06:12:46

问题


How to get how many hours has users spent playing my game? Using Steamworks API and C# in Unity. I have went through a documentation but haven't found anything like that, and thinking that I am missing something.

I should've just went with a simple script that logs minutes played in its own game, but it's too late for that. If anyone can give me a hit or point me a right direction, I'd really appreciate it.


回答1:


You might still have a chance to get it to work. As far as I know, there's a way to get the total hours played (as shown in the Gameplay stats) by using the deprecated Community XML Data:

Player Game Stats

To retrieve game stats, you will need the game's Steam Community name. Developers can contact Valve to obtain the community name for their game.

You can retrieve stats and achievements for a player per game using the player's 64-bit Steam ID with: Format: http://steamcommunity.com/profiles/[SteamID]/stats/[CommunityGameName]/?xml=1

Example: http://steamcommunity.com/profiles/76561197968575517/stats/L4D/?xml=1

In the example you can see the hoursPlayed field on the bottom of the image:

Now, the problem obviously is that this is deprecated and Steam advices you to use the web APIs whenever possible. However, I haven't seen a way to access this data through the web API so I think that this is your best bet without rolling out a custom way of tracking playtime.



来源:https://stackoverflow.com/questions/45764769/how-to-get-how-many-hours-has-users-spent-playing-my-game-steamworks-api

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!