I have no crash, but for me just switching to a given Layout with the press of a button doesn't work.
Just make an empty cap, two layouts. Each Layout has its own Sprite object (different positions and colors, for easier differentiation). And a global MouseKeyboard Object.
+ On 'Space' pressed:
-> Go to Next Layout/Switch to Layout Nr.(either behaves the same)
I have one of this Event on each of the two Layouts:
+ On 'Space' pressed:
-> Switch to Layout Nr.
However, every time after the application has been started, the first press will always only reload the current layout, each consecutive press works as expected (according to Events).
No transition picked.
EDIT: Nevermind. It seems that had to do with the MouseKeyboard Object being global and checking on each Layout at the same time for some reason? I don't know, still weird actually.
But the reason I say that, is because when I changed the Button in one of the Events to another, it worked right away.
But shouldn't the Events of a Layout only be checked, if it is the current Layout? And not because there is a global Object inside an Event?
Still it doesn't make sense, because even when I made a new MouseKeyboard Object for each Layout, it behaved like this.
2nd EDIT: Okay, here's what I found out now. It has nothing to do with the MouseKeyboard Object being global. It is indeed the Layout Switch making trouble. The first time You make a layout switch after application start, it will in fact read switch to the other Layout AND continue reading the Events of the new Layout in the SAME Tick. It will add the Events of the new Layout to the current Tick.
The next time You switch Layouts, it works as expected.
You can check this by switching the layout upon a button press, and increase a global variable by one.
Now on the second Layout, for the same button press, You switch the layout back to the first, and increase the same variable by one.
If You now press the button the first time, the variable will increase by 2, after that each consecutive press will just increase by one.