1

using this kind of contstruction:

Container.Bind<Freeman>()
        .FromMethod(_ => { return Container.InstantiatePrefabForComponent<Freeman>(freemanPrefab); })
        .AsTransient()
        .OnInstantiated<Freeman>((injCtx, freeman) =>
        {
            Debug.Log(freeman.name);
        });

The Debug.Log never works meaning the OnInstantiated never being called. Why is that?

vladroot
  • 11
  • 2

1 Answers1

0

I've had this issue too. In my case I didn't inject binded class. And as it binds lazily by default I had to add .NonLazy() instruction at the end of the binding. Hope this reminder will help to someone to save precious minutes. Cheers. :)