Skip to content

Internal indexing problem when adding and removing hooks during same Unity event #384

@timsgardner

Description

@timsgardner

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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions