Looking-Glass / JoyconLib

Joy-Con library for Unity.
MIT License
467 stars 91 forks source link

LoadScene crashes Unity when JoyconManager.cs is being used #15

Open jbccollins opened 5 years ago

jbccollins commented 5 years ago

Following the Unity instructions here: https://docs.unity3d.com/ScriptReference/SceneManagement.SceneManager.LoadSceneAsync.html I copy pasted that code into here: https://github.com/jbccollins/cornhole-simulator/blob/master/Assets/CrashingSceneController.cs

And that runs fine. However, if I add the JoyconManager.cs script as a component to anything then the call to LoadScene will completely crash Unity. Any idea why that might be?

OliJimbo commented 5 years ago

I'm also having this problem - this is easily reproducible by duplicating the sample scene and adding SceneManager.LoadScene("scene2") to one of the button responses.

Has anyone found a work around for this?

EDIT

Narrowed this down a little.

The issue seems to be that if more than one Joycon manager object is in the project (even if it deactivated), Unity will crash when another is loaded. I've tried destroying with object.Destroy before changing scene, but that doesn't work.