ssannandeji / Zenject-2019

Dependency Injection Framework for Unity3D

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[InjectOptional] int causes NullReference

NoxMortem opened this issue · comments

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)