Skip to content

Version 6.1.0

Compare
Choose a tag to compare
@svermeulen svermeulen released this 17 Jun 13:43
· 305 commits to master since this release

Targetting Unity 2017.4.0 but compatible up to 2018.2 and possibly more

Large release with lots of new features, bug fixes, and performance improvements. Some API changes to be aware of before upgrading. See the upgrade guide for details

This will also be the beginning of a Zenject LTS stream that will follow Unity LTS

Significant:

  • Replaced the signals system with a very different 'event bus' like approach. Also fully decoupled signals from zenject core so it can be unchecked from OptionalExtras when importing
  • Removed ability to use AsSingle with the same type across multiple bind statements. If you want to map multiple contracts to the same AsSingle, you need to include multiple types in the Bind(..) or use FromResolve
  • Renamed Factory<> to PlaceholderFactory<>
  • Changed behaviour during OnApplicationQuit to not forcefully destroy all scenes and their contents. This was added previously to force a reasonable destruction order, however it breaks things on android so was turned off by default. However it can be re-enabled via ZenjectSettings for people that need a predictable destruction order
  • Changed validate keyboard shortcut from CTRL+SHIFT+V to CTRL+ALT+V to avoid conflict with Vuforia

Notable:

  • Performance improvements - in some cases doubling the startup speed. Also allocates a lot less garbage now by using memory pools internally
  • Added support for automatically loading parent scene contracts and decorated scenes by including a config file in resources that specifies default scenes for certain contract names
  • Added support for "decorator" bindings by calling Container.Decorate (see docs for usage)
  • Added support for much more complex custom factory configuration using FromIFactory in addition to just FromFactory
  • Added new type of Test Fixture called SceneTestFixture to run tests on a given production scene
  • Added ability to use [Inject], IInitializable, etc. from within custom user DLLs by referencing Zenject-Usage.dll
  • Added ability to add user supplied validation logic by deriving from IValidatable
  • Also added a way to set global zenject settings to control things like validation behaviour, error output, etc. through the ProjectContext inspector
  • Renamed Zenject.Lazy class to Zenject.LazyInject to avoid name conflict with System.Lazy on .NET 4.6 (we cannot use System.Lazy directly because of issues with IL2CPP)
  • Fixed to automatically inject StateMachineBehaviour derived classes attached to Animator components
  • Changed the default value for includeInactive parameter to FromComponentX methods to be true, since this is very important when instantiating prefabs and therefore makes more sense as a default
  • Fixed some issues related to binding open generic types
  • Added documentation for ZenAutoInjecter to allow injection to occur when using GameObject.Instantiate
  • Added debugging window to monitor all active memory pools (aka Memory Pool Monitor Window)
  • Changed MonoMemoryPool to automatically revert to the original parents during despawn
  • Changed to automatically add profiling information for ITickable.Tick, IInitializable.Initialize, IDisposable.Dispose methods, when inside the unity editor and when the unity profiler is open. This now functions similar to MonoBehaviours in that these methods will automatically be listed in Profiler.
  • Bind methods that involve a lookup now have a plural and non-plural versions (this includes FromComponentInChildren, FromComponentInParents, FromComponentSibling, FromComponentInNewPrefab, FromResource, FromResolveAll, and FromSubContainerResolveAll)
  • Misc. bug fixes

Minor:

  • Updated the sample projects to use more modern techniques
  • Added missing bind methods to Container.Bind such as ByNewPrefabMethod, ByNewPrefabInstaller, ByNewPrefaResourceInstaller, and ByNewPrefabResourceMethod
  • Added events on SceneContext, GameObjectContext, and ProjectContext to hook into post-install / pre-install events
  • Standardized the naming of the bind methods for custom interfaces for factories and memory pools. BindFactoryContract was renamed to BindFactoryCustomInterface and the overload of BindMemoryPool taking a custom interface was renamed BindMemoryPoolCustomInterface
  • Added optional InjectSources argument for FromResolve and FromResolveGetter bind methods
  • Changed ZenjectEditorWindow to handle failures better
  • Added DisposeBlock class to make it easier to avoid unnecessary per frame memory allocations
  • Added StaticMemoryPool class for cases where you want to store a pool statically instead of inside a container
  • Added ability to combine Dispose pattern with PlaceholderFactory<> to pool objects without needing to explicitly create a MemoryPool class (see memory pool docs for details)
  • Added methods to expand and shrink memory pools. Also added optional OnDestroy user method to handle shrink operations
  • Added ability to more easily pool facade/subcontainers
  • Added Resize() method to Memory Pool classes
  • Added FromComponentOnRoot bind method for game object contexts
  • Added ZenjectStreams class for easier integration with UniRx
  • Added FromMethodMultipleUntyped bind method
  • Renamed ByNewPrefab to ByNewContextPrefab
  • Added FromComponentOn/FromComponentsOn bind methods
  • Added FromComponentOnRoot/FromComponentsOnRoot bind methods