InputSystem icon indicating copy to clipboard operation
InputSystem copied to clipboard

"Handle is not allocated" when exiting play mode, with duplicate objects

Open hwaet opened this issue 7 years ago • 4 comments

I've noticed that the system throws an error when exiting play mode, if there are several objects that subscribe to actions in the same action map:

InvalidOperationException: Handle is not allocated System.Runtime.InteropServices.GCHandle.get_Target () at ....InputSystem/Actions/InputActionState.cs:3132

This happens in my project where there are several active objects on screen listening for the player's inputs. I noticed that the same thing happens in the simpleDemo project in this repo, if I duplicate the player object and then enter/exit play mode.

hwaet avatar May 26 '19 03:05 hwaet

Same here! Thanks!

eblabs avatar Jun 02 '19 04:06 eblabs

I can't remember right now what exactly led my code to same errors, but this is related with disabling and disposing your map and actions. Something like calling map.Dispose() won't disable it automatically and later if you try (or some internal code triggers) .Disable() map, it will try to clear out already cleared memory.

elhimp avatar Jun 08 '19 13:06 elhimp

I cannot repro this with 0.3.0-preview. Duplicating Player object in the SimpleDemo scene doesn't trigger the error.

JiaUnity avatar Jun 14 '19 01:06 JiaUnity

That's great news! I just updated to 0.3.1 and confirmed the fix with a much more aggressive test case. Thank you!

hwaet avatar Jun 19 '19 02:06 hwaet