Skip to main content

Zenject

Unity Playworks Plugin supports Zenject up to version 8.0.0.
Unity Playworks Plugin doesn't support DLL versions of plugins so it is required to include the C# source files inside your project.

This guide is for developers who are using Zenject in their Unity projects as DLLs.


  1. Download or clone the Zenject source code on GitHub.
  2. Move the Zenject source files located inside Zenject-master > UnityProject > Assets > Plugins > Zenject outside Zenject-master.

images-small

  1. You will receive some console errors that need resolving but don't worry, these are caused by DLL usages requests within the plugin. To clear the errors you will need to remove then replace Zenject > Source > Usage folder contents (containing the DLL) with the contents of Zenject-master > AssemblyBuild > Zenject-usage with is the source files.

Remove the DLL usage:

images-small

Move the source usage

images-small

  1. Once this is done you can remove the Zenject-master from your project. You can also remove optionalExtras from the Zenject folder.

  2. The final step will be an invisible build error caused in Luna. This error is caused by a specific script called CachedProvider.cs, and the pre-processor directives (#if and #endif), which can cause build errors in Luna.

To resolve the build compilation failure you should comment out all pre-processors from this script which will allow for a successful build.

Example:

List<object> _instance;

// #if ZEN_MULTITHREADING
readonly object _locker = new object();

// #else
bool _isCreatingInstance;
// #endif
You may need to restart Unity as some errors might be present due to cache.