Skip to content

How can i have Dynamic Descriptor #103

Answered by sebas77
salawaji asked this question in Q&A
Discussion options

You must be logged in to vote

Svelto.ECS doesn't allow adding/removing components AFTER an entity is built, but you can add dynamically components to an entity descriptor before the entity is built.
The components added dynamically will be regularly swapped / removed like static components. In order to achieve this, you need to use DynamicEntityDescriptor and a specific BuildEntityOverload:

 EntityInitializer BuildEntity<T>(uint entityID, ExclusiveBuildGroup groupStructId, T descriptorEntity,
            IEnumerable<object> implementors = null,
            [System.Runtime.CompilerServices.CallerMemberName] string caller = null) where T : IEntityDescriptor;
    if (condition)
            {
                _componentBui…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sebas77
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
FAQ Svelto FAQs
2 participants