Forums

OverviewV-Play 1 SupportFound Bug? (EntityManager) › Re: Found Bug? (EntityManager)

OverviewV-Play 1 SupportFound Bug? (EntityManager) › Re: Found Bug? (EntityManager)
#4115

Christian
V-Play Team

Hi Hochi,

I had a look at the EntityManager (EM) and did write a test for your described behavior. However, everything works as expected and I could not find any problems!?

Could you post the relevant source code that is not working as expected here please?

Without specifiying your own entityId, the EM should not post a warning about the id being already defined and not append a “_”.It only does that, if you manually set the same entityId. And if your provided one already exists, it will change the id so it is unique.

This is the example I used:


      SimpleButton {
        text: "add normal"
        onClicked: {
          var newEntityProperties = {
            x: Math.random()*scene.width,
            y: Math.random()*scene.height,
            rotation: Math.random()*360,
            // NOTE: if an entityId is set explicitly, the entityManager will try to set it to this id
            // however, when the entityId already exists in the entityManager, a "_" will be appended
            // thus always retrieve the entityId after a call to createEntity...()
            entityId: "entityNormal"
          }

          var entityId = entityManager.createEntityFromUrlWithProperties(Qt.resolvedUrl("EntityNormal.qml"),newEntityProperties);
          console.debug("created entity with id:", entityId)
        }
      }


      SimpleButton {
        text: "remove normal"
        onClicked: {
          //entityManager.removeEntitiesByFilter(["entityNormal"]);

          // when 3 entities are added, and all of them got set the entityId set to "entityNormal", they are removed correctly here
          entityManager.removeEntityById("entityNormal")
          entityManager.removeEntityById("entityNormal_")
          entityManager.removeEntityById("entityNormal__")
        }
      }

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