sschmid / Entitas

Entitas is a super fast Entity Component System (ECS) Framework specifically made for C# and Unity
MIT License
7.11k stars 1.11k forks source link

Boolean in setttings for unique components to actually be unique #1070

Open Discipol opened 1 year ago

Discipol commented 1 year ago

Right now, a unique component is both inside an anonymous entity directly in the context, as in _contexts.game.ReplaceCheese("Mozarella") but you can also do `_contexts.game.CreateEntity().ReplaceCheese("Mozarella")'

My devs, fresh into Entitas, often do the latter when they actually meant the former, causing issues.

I am requesting the ability to have unique component in the context only (possibly as a boolean in Jenny.properties) and NOT inside the entity of that context.

Is it necessary to have them in the entity? No problem, simply reduce the scope of Add, Remove, Replace, Has so it works internally, but publicly, only the context's version are available. Having your cake, and eating it too :D