gogcom / galaxy-csharp-demo-game

GOG Galaxy Integration Demo
Other
35 stars 9 forks source link

Unity crash after second scene launch #9

Open TonyZub opened 1 year ago

TonyZub commented 1 year ago

Each second start scene launch - unity crashes.

Actual steps to reproduce: 1) Download galaxy-csharp-demo-game repository 2) Open it with unity (the same version as in project - 2019.4.2f1) 3) Install Galaxy SDK [1.150] package (with Assets - import package) 4) Launch "StartingScreen" scene 5) Stop playmode after a few seconds when sdk is running (it actually connects and works ok) 6) Launch "StartingScreen" scene again

Not sure why this is happening (looks like it only happened with me). Tried to manually make GalaxyInstance.Shutdown() when playmode stops but it didn't help.

IMPORTANT - previous version of SDK [1.148.3] doesn't have such issue.

crash.zip Editor.log error.log

JacobDzwinel commented 1 year ago

I can confirm this happens also in my project after 1.150 upgrade.

I'm using Unity 2020.3.32f1

stickgrinder commented 9 months ago

Same here, even porting the code to another project. Unity 2020.3.48f1.

Seems to be related to the second execution of Init().

Anyone found a solution?

alanlawrance commented 4 months ago

I've found the same problem while doing an integration into a Unity 2022.3.23 project. Any workarounds? Doesn't appear to be an issue in a standalone build.

KyleBanks commented 2 months ago

For anyone still facing this issue, I stumbled upon some sample code in the GOG SDK which shows how to fix this issue.

In the GalaxyManager replace the call to GalaxyInstance.Shutdown(true); on line 115 with:

if (Application.isEditor)
{
    ShutdownParams shutdownParams = new(true);
    GalaxyInstance.ShutdownEx(shutdownParams);
}
else
{
    GalaxyInstance.Shutdown(true);
}