Forums

OverviewV-Play 1 SupportEntityManager does not remove EntityBaseDraggable › Reply To: EntityManager does not remove EntityBaseDraggable

OverviewV-Play 1 SupportEntityManager does not remove EntityBaseDraggable › Reply To: EntityManager does not remove EntityBaseDraggable
#4479

Christian
V-Play Team

Ah I got it, thanks to your great example it was easy to find!

The reason why it did not work, is the internal behaviro of the BuildEntityButton: it creates an entity for each button, which gets then dragged around. However, this entity should not be removed when you call entityManager.removeAllEntities, thus it sets its preventFromRemoval flag to true. So what you can do to solve your use-case, is just make the created entity invisible once the game is over, or easier done when the BuildEntityButton gets invisible. So add this code to your BoxPreview and it should work fine:

    // at changing the scene, make the internally created entity from BuildEntityButton invisible at well
    onVisibleChanged: {
      if(!visible) {
        createdEntity.visible = false;
      }
    }

Cheers, Chris

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support