Problems with Switch port

Hey @aron_granberg, so I just tried porting my project to Switch for the first time and found that the build wouldn’t run on the devkit (just seeing a black screen). I have managed to successfully built and run a few test projects with some basic code running, so I have confirmed I’ve got the SDK and everything set up properly.

I’ve also confirmed the problem is coming from A* Pathfinding by simply testing an empty scene with just a cube with no AstarPath, and the exact same scene with AstarPath on it. I also see in the stack trace a few mentions of Astar* stuff; have a look at the stack trace here: https://pastebin.com/CstZn9f8 (maybe you can make some sense of it?)

I understand you haven’t got a dev kit to test switch stuff with, so it’ll probably be difficult for you to help fix this, but thought I’d post about it anyway to hopefully start building a knowledge base amongst other switch developers (and to nudge you towards getting a dev kit to support it officially :grinning: )

Ok, someone mentioned it before on the other Switch thread and it looks like someone in the nintendo dev forums have run into the same problems and came up with the same fix

Find the file LockFreeStack.cs and you’ll find three places with conditional compilation:

#if UNITY_IPHONE || UNITY_PSP2 || UNITY_XBOXONE || UNITY_PS3 || UNITY_PS4 || UNITY_WIIU

You have to add " || UNITY_SWITCH" at the end of these three lines and it won’t freeze after that.

Unfortunately it appears this file ‘LockFreeStack.cs’ does not exist anymore, perhaps this code has been moved to another file?

Ok I’ve done some more investigating and based on the stack trace, the problem is coming from JsonSerializer.cs, in OpenDeserialize(byte[] bytes)

The stack trace doesn’t exactly give us a line number where the error is from, so I’ve put in a number of debug logs to see at which point it gets to before failing:

‘FOO 3’ is the last thing comes up before the failure happens, so that leads me to believe what’s in the try block is the culprit here, something to do with the ZipFile class isn’t working?

OK I seem to have fixed all the Astar related problems by defining ASTAR_NO_ZIP in the scripting define symbols list. Not 100% sure this is the fix because now I’ve got some other errors coming through in the stacktrace unrelated to Astar, will update again later

1 Like