The following binding fails to find the parent transform:
Container.Bind<EncounterCharacterUI>().FromComponentInNewPrefabResource("UIPrefabs/EncounterCharacterUI").UnderTransform(ctx => { var instance = (MonoBehaviour)ctx.ObjectInstance; return instance?.transform; }).AsTransient();
... because ObjectInstance comes back null. Upon inspection I realized the _prefabInstantiator inside GetAllInstancesWithInjectSplit method creates a new InjectContext, losing reference to the original context's ObjectInstance in the process.
Is this by design? If so, what is the reason for not creating a subcontext here?
The following binding fails to find the parent transform:
Container.Bind<EncounterCharacterUI>().FromComponentInNewPrefabResource("UIPrefabs/EncounterCharacterUI").UnderTransform(ctx => { var instance = (MonoBehaviour)ctx.ObjectInstance; return instance?.transform; }).AsTransient();
... because ObjectInstance comes back null. Upon inspection I realized the _prefabInstantiator inside GetAllInstancesWithInjectSplit method creates a new InjectContext, losing reference to the original context's ObjectInstance in the process.
Is this by design? If so, what is the reason for not creating a subcontext here?