Skip to content

Conversation

@ngokevin
Copy link
Member

@ngokevin ngokevin commented Apr 16, 2019

Description:

Preserves component data if entity is detached so entity could be reattached okay. If entity is detached, it should run component pause/remove callbacks, but can still keep the component reference + data.

If a component is explicitly removed, then we destroy the component and its data.

  • Need to figure out how to possibly avoid memory leak if developer detaches an entity, but then does nothing with it, need to return the component objects to pool. Do we need an Entity.destroy()? If this use case is supported (detach entity and attach somewhere else in scenegraph), then do we need components to have a separate destroy handler? Or do we just not call Component.remove unless it is being destroyed and count the remove as the destroy handler.

Changes Proposed:

  • Allow entities to be detached and reattached while maintaining component data.
  • Entity.destroy() method for when you detach an entity and never want to use it anymore, you can call the .destroy() method.

@Moon-ChangHyun
Copy link

There seems to be a mistake in Entity.destroy().
In that method it seems that this.el.parentNode should be modified to this.parentNode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants