Skip to content

Best Practice For Storing an array of data in entity component #82

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

You must be logged in to vote

Using NativeDynamicArray for this kind of thing is fine. You don't need necessarily to use entities for this though, you can have your own datastructure, in your own class, that you inject in engines. This practice is mixing OOP and ECS and I discussed It in my article about OOP abstraction in an ECS centric application.
You can also use a managed component, implementors can be any kind of object.
Since in future I want to make implementors less and less useful, I will introduce the concept of IManagedEntityComponent, so you can use normal c# arrays. Of course, you cannot burstify them, so if you need burst, either your own data structure or NativeDynamicArray is ok.

Replies: 2 comments 7 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by simeonradivoev
Comment options

You must be logged in to vote
7 replies
@sebas77
Comment options

@simeonradivoev
Comment options

@simeonradivoev
Comment options

@sebas77
Comment options

@sebas77
Comment options

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