Test (unity) app does not shut down properly.
If you run the test app, and then close it, Steam thinks it's still running and won't close.
Same thing happens with my game after integration. Have to manually kill the steam process in order to kick start it again. On Jul 10, 2014 4:25 AM, "JocelynSachs" [email protected] wrote:
If you run the test app, and then close it, Steam thinks it's still running and won't close.
— Reply to this email directly or view it on GitHub https://github.com/rlabrecque/Steamworks.NET/issues/13.
Could you throw in a breakpoint and see if this part of the sample Runs properly:
// Assets/Scripts/SteamManager.cs Line 99
private void OnApplicationQuit() {
if (!m_bInitialized) {
return;
}
SteamAPI.Shutdown();
}
It sounds like the game is never actually shutting down properly.
I put logging in and it does hit that point. On 10 Jul 2014 16:21, "Martin Evans" [email protected] wrote:
Could you throw in a breakpoint and see if this part of the sample Runs properly:
// Assets/Scripts/SteamManager.cs Line 99 private void OnApplicationQuit() { if (!m_bInitialized) { return; }
SteamAPI.Shutdown();}
It sounds like the game is never actually shutting down properly.
— Reply to this email directly or view it on GitHub https://github.com/rlabrecque/Steamworks.NET/issues/13#issuecomment-48619342 .
I have exactly the same problem. SteamAPI.Shutdown() gets called properly, but Steam doesn't understand it. Possibly a problem with the underlying steam_api.dll (or CSteamworks.dll)?
Further analysing the problem - Calling SteamAPI.Shutdown() does close the Steam Overlay, but SteamClient still thinks the game is on.
Hrm, interesting. What platform(s) is this happening on? Is this in the editor or in standalone builds? OSX in particular has been finicky with this in the past but I thought Valve had fixed it already.
I recently switched from using OnApplicationQuit() to OnDestroy(), OnApplicationQuit is called too early and often gets interleaved with OnDisable which is often used to turn off Steam features like Callbacks.
I'd recommend trying to see if switching Shutdown back into OnApplicationQuit helps.
http://steamcommunity.com/groups/steamworks/discussions/0/540744934414455840/#c35221584653888328
Platform is Windows (Mac OSX version as far as I know works properly. Linux version not tested). And yes indeed, changing it back to OnApplicationQuit() fixed the problem! Thanks!
Interesting, Looks like I'll have to switch it back. Glad that it fixed it for you though!
@jkarkkainen Could you try out this improved version of SteamManager.cs and see if it works any better or if you still need to use OnApplicationQuit()?
I can confirm that both the OnApplicationQuit() or OnDestroy() do not shut the app down. (Steam still says playing)
EDIT: After lots of testing: shutting down works on both Linux and Mac. On windows shutting down works 6/10 times.
Sorry for the long delay. After updating to 5.0.0, and changing the SteamAPI.Shutdown() to OnDestroy(), Steam now properly recognizes that the game has quit (On both Windows and Mac, atleast). Although, it sometimes worked before as well, so I can't be totally sure it's completely fixed now. Thanks for your work with Steamworks.NET!
I am still having this issue unfortunately. Even manually calling SteamApi.Shutdown() at any time in the game's lifecycle does not do anything :( I'm using the latest build and latest example, and the example also has this problem.
Hi, I'm having the same issue too. I'm using Unity 5.0.0 b19 32 bits with the latest Steamworks.NET stable version (5.0.0).
It happens when running the game both from Unity and from Steam (Windows 8.1 Pro 64 bits). In fact when running from Unity, you can clearly see that even after stopping the game and calling SteamApi.Shutdown(), the game is shown as "currently playing" on my Steam profile.
So with @derosa's help there's been some improvements.
His issue ended up being Unity starting adb.exe for Android Development. Steam tracks all subprocesses (I.E. if there's a launcher) and if something that has been launched from Unity remains open afterwards it will still detect you as In-Game. (Visual Studio, MonoDevelop are common culprits as well!)
With commit 3e4580294b423517315cbde9135cb275d03e9235 Steamworks.NET now checks to ensure that SteamAPI.Init() has not been called more than once per session. The big thing that this should hopefully help with is checking SteamManager.Initialized after SteamAPI.Shutdown() has been called (say in an OnDestroy that gets called after SteamManager goes away).
And just a reminder that Steam will always show you as In-Game when the editor is open after you play in the editor once.
Do any of these help you @omgnoseat?
I'm having this issue too, I'm afraid. Even after closing down Unity/Visual Studio, the client still says I'm playing the game. This also affects the build too; playing the game through the Steam client and then quitting does not reset what game I'm playing.
http://steamcommunity.com/groups/steamworks/discussions/0/611696927914497414/
There is this report of it happening due to the launcher, I haven't had a chance to investigate that yet, but it's another thing to look into.
Edit: Steamworks.NET-Test and -Example both use the launcher and I can not reproduce this with either of them still. :(
@rlabrecque commit 3e45802 seemed to do it for me, thanks! :+1:
Not Steamworks.NET related but I found this pretty funny and relevent to this issue: http://steamcommunity.com/groups/steamworks/discussions/0/612823460253767971/
If you're still having this issue at this point please try running Process Explorer to see if your project launches any subprocesses.
Is there a reason _intialized is not set to false in Shutdown()?
I'm accessing global stats from editor windows and if I don't call Init(), I get "Steamworks is not initialized.", but calling Init() gives "Tried to Initialize Steamworks twice in one session!". Currently I'm setting _initialized=false in Shutdown(), but I'm concerned that's defeating whatever commit 3e45802 was trying to fix.
Hey @WazWaz, that commit is largely trying to fix calling SteamAPI_Init from OnDestroy/OnDisable/OnApplicationQuit, which could occur after SteamAPI_Shutdown has already been called. This results in no final Shutdown() being called, and hence this issue. (Well, atleast part of this issue.)
By setting _initialized to false ever you counteract this safeguard. This wasn't implemented with your use case in mind. so what you're doing (or even ripping out the _initialized stuff completely) would be completely fine.
Looks like this experiment worked out, but I've since removed it and moved it into SteamManager.
Commit where it was removed: f02de041669bf0183356de3ab65b012c7426afa2 Additional reading: #59 Commit where it was added to SteamManager: https://github.com/rlabrecque/SteamManager/commit/91d821a5d0a8095878c341fb05e5330a7ebac8b9