sschmid / Match-One

This is a simple and interactive Unity3d example project to show how to use Entitas
https://github.com/sschmid/Entitas
201 stars 55 forks source link

Input bug in burst mode #2

Closed JEphron closed 8 years ago

JEphron commented 8 years ago

When in burst mode it's easy to crash the game by simply dragging downwards. This happens because in ProcessInputSystem.cs:18 entities.SingleEntity(); is called, but in InputController.cs:16 many entities with Input components are created before ProcessInputSystem has a chance to clear them.

I don't know what the framework-correct way to fix this is, but iterating over the entities array in ProcessInputSystem instead of calling SingleEntity() fixes the problem (but raises another bug whereby you can get an ArrayIndexOutOfRangeException, which could probably be fixed with a bounds-check, but anyway), so I'll just leave this as an issue since maybe there's a more correct way of doing it.

sschmid commented 8 years ago

Hey, thanks for the hint. I could reproduce the array out of range issue and fixed it 511235b7333493c98c248bb21046583807725b4f

but I couldn't reproduce what you said with dragging downwards... Maybe the my fix also fixes that :)

sschmid commented 8 years ago

I just updated Match-One to use Entitas 0.32.0. I completely replaced the GameBoardCache with the new EntityIndex feature. This most likely fixes this issue.