Skip to content
This repository was archived by the owner on Sep 25, 2025. It is now read-only.
Vladislav Kantaev edited this page Apr 24, 2021 · 4 revisions

Sometimes it may be possible to improve performance by baking reflection that the framework relies on. In Unity's top menu, select DI/Baking/Bake to bake DI data. The result of a bake is a C# class that defines calls to Construct methods of all detected injectable types.

Advantages:

  • Possibly higher performance due to avoidance of reflection
  • No problems with code stripping (because Construct methods become used by the DI data class)

Disadvantages:

  • The need to frequently rebake DI data, which requires recompilation

DI Settings (by default, located at Assets/Resources) allow to configure the baking process:

  • Use Baked Data - turns on and off usage of baked injection data. Given this option disabled, the framework will ignore any existing baked data.
  • Baked Assemblies Regex - a regular expression for the names of assemblies, which will be used for baking. For changes to take effect, a rebake is required.

Clone this wiki locally