Custom GameLogic SetContainer called twice

Equinox shared this bug 5 years ago
Outdated

When there is only one custom game logic component attached to an entity SetContainer will be called twice, resulting in two calls to OnAddedToContainer.

        public static MyGameLogicComponent Create(ICollection<MyGameLogicComponent> logicComponents, MyEntity entity)
        {
            foreach (MyGameLogicComponent myGameLogicComponent in logicComponents)
            {
                myGameLogicComponent.SetContainer(entity.Components); // first call here
            }
            switch (logicComponents.Count)
            {
            case 0:
                return null;
            case 1:
                return logicComponents.First<MyGameLogicComponent>(); // second call when the returned component gets added
            default:
                return new MyCompositeGameLogicComponent(logicComponents);
            }
        }

Replies (1)

photo
1

Hello, Engineer!


Thank you for your feedback! Your topic has been added between considered issues.Please keep voting for the issue as it will help us to identify the most serious bugs.


We really appreciate your patience.


Kind Regards

Keen Software House: QA Department

Leave a Comment
 
Attach a file