luxeengine / alpha

alpha - deprecated 2015~2016. unrelated to the new engine! view the new engine here - https://luxeengine.com/
MIT License
565 stars 74 forks source link

Entity; init wont fire when added as child #340

Closed Zielak closed 8 years ago

Zielak commented 8 years ago

Scenario: I add 3 entites (icons) to another entity as children (background for those icons). I need to change all the icons, so I remove them and add new set of icons with the same parent.

In demo press first D to remove TestVisuals and then A to add new visuals.

Watch the console, it prints out every init() and onadded() that fires.

when I create TestVisual without parent, then init fires fine (comment out https://github.com/Zielak/luxe_bug_entity_init/blob/master/src/Main.hx#L224)

DEMO: http://darekgreenly.com/pub/luxe_bug_entity_init/ REPO: https://github.com/Zielak/luxe_bug_entity_init

Zielak commented 8 years ago

It also helps to add those entities to scene after they're created with Hud.hud_scene.add( vis ); instead of in constructor.

ruby0x1 commented 8 years ago

p.s see the discussion on #372 as well, this seems related. It seems a lot of the two hundred lines of example code might be related to turning the luxe log level up and seeing what the debug text prints. (I have been meaning to look at this but such verbose test cases make it harder to digest, and my focus is on embers atm, the scene/entity focus is yet to come! Sorry for the delay)

ruby0x1 commented 8 years ago

Can you try again with the latest commit and let me know if you have further issues, thanks!