Skip to content

If implementors are not recommended anymore, how can I use strings in entity components? #90

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

You must be logged in to vote

As for other objects, the best way to handle strings is to use the OOP abstraction layer theory.

https://www.sebaslab.com/oop-abstraction-layer-in-a-ecs-centric-application/

however Svelto.ECS already provides an un contextualised resource manager for strings that can be used with due care:

public struct InventorySearchFieldEntityStruct : IEntityComponent
    {
        public ECSString userString;
    }

which can be initialised as:

userString = new ECSString(name);

ECSString is just an unmanaged ID, you can then convert to a string with an explicit cast.

Replies: 1 comment

Comment options

sebas77
Oct 21, 2022
Maintainer Author

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
1 participant