amethyst / specs

Specs - Parallel ECS
https://amethyst.github.io/specs/
Apache License 2.0
2.51k stars 221 forks source link

Dynamic MarkerComponents #676

Open jkelleyrtp opened 4 years ago

jkelleyrtp commented 4 years ago

I'm curious if it's possible to implement a way of tagging items dynamically. Currently, the status quo is to use the marker component, but there might be times where the marker might be user-generated at runtime rather than at compile time. Is there a current strategy implemented in Specs without me having to implement a custom storage solution?

a1phyr commented 4 years ago

Maybe you could use a Set<T> as a component (given that you use type T to represent user-generated markers) and check whether the value corresponding a given marker is in the Set ?