jeffcampbellmakesgames / Entitas-Redux

An entity-component framework for Unity with code generation and visual debugging
MIT License
102 stars 13 forks source link

Gate all uses of Contexts.SharedInstance behind a #define #65

Closed JesseTG closed 2 years ago

JesseTG commented 2 years ago

Description

I don't use Contexts.SharedInstance in my game, because I rely heavily on dependency injection instead of singletons. However, I don't want to risk instantiating Contexts.SharedInstance by mistake, as that could lead to a very frustrating and confusing debugging session.

Hence, I wrapped all built-in uses of the generated field in #if !ENTITAS_REDUX_NO_SHARED_CONTEXT. To disable Contexts.SharedInstance in your project, define that symbol. Otherwise, existing code will continue to work as-is.

How Has This Been Tested?

I added a local build of the plugin to my own project. Works like a charm.

Checklist:

jeffcampbellmakesgames commented 2 years ago

This has been merged to develop and should be available soon in v2.1.3.