如何获得用户玩我的游戏花了多少小时?蒸汽工厂 API

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

如何知道用户玩我的游戏花了多少小时?在 Unity 中使用 Steamworks API 和 C#。我浏览了一份文档,但没有找到类似的东西,并认为我遗漏了一些东西。

我本应该使用一个简单的脚本来记录自己游戏中的上场时间,但为时已晚。如果有人能给我一击或指出正确的方向,我将不胜感激。

您可能仍有机会让它发挥作用。据我所知,有一种方法可以通过使用已弃用的 Community XML Data:

来获取总播放时间(如 Gameplay stats 所示)

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

在示例中,您可以看到图像底部的 hoursPlayed 字段:

现在,问题显然是这已被弃用,Steam 建议您尽可能使用网络 APIs。但是,我还没有找到通过网络访问此数据的方法 API 所以我认为这是最好的选择,而无需推出自定义的播放时间跟踪方式。