Dependency Injection with Actions

lampcord

New member
I'm trying to create custom actions in Behavior Designer that use dependency injection to receive their instances of various AI services that I'm developing. I'm using Zenject as the DI framework.

For some reason, the same [Inject] directives that work everywhere else in my code do not seem to work within a custom Behavior Designer Action. So I'm wondering, how does Behavior Designer create instances of custom actions? For some reason they seem to be getting created outside of the object graph of the dependency injection framework.

Does anyone have any idea of why this would happen?

Does anyone have any experience using DI from within Behavior Designer?
 
I have heard of people using dependency injection with it but I have never done it so I don't know how. You may need to install the runtime source to add support for it though:

 
Thanks! I can always work around this by writing a simple service locator and assigning the service at startup.

But I just thought if someone had experience using these two frameworks together there might be a simple fix.
 
Top