[InjectOptional] int causes NullReference
NoxMortem opened this issue · comments
Kevin Streicher commented
Found during reporting https://github.com/modesttree/Zenject/issues/638
Documentation
If the dependency is a primitive type (eg. int, float, struct) then it will be injected with its default value (eg. 0 for ints).
This causes a NullReference
public void Inject([InjectOptional] LayerController layerController, [InjectOptional] int controlsLayer)
This does not:
public void Inject([InjectOptional] LayerController layerController, int controlsLayer = 0)