Arcadia
Arcadia copied to clipboard
Internal indexing problem when adding and removing hooks during same Unity event
To reproduce:
(require '[arcadia.core :as ac])
(def test-obj (UnityEngine.GameObject. "test-obj"))
(def counter (atom 0))
(ac/defrole role-1
(update [obj k]
(ac/role- obj k)
(ac/state obj k)))
(ac/defrole role-2
(update [obj k]
(ac/role+ obj :role-1 role-1)))
(ac/role+ test-obj :role-2 role-2)
The problem seems to be that the length of the ArcadiaBehaviour.ifnInfos
array changes as it is being iterated over. In addition to potentially skipping registered functions for the current Unity event, this puts HookStateSystem.ifnInfoIndex
in a bad state, leading to this bug.