1

This is for Zenject being used with Unity.

I have a Project Context that holds a monoinstaller which should make bindings and the signalbus global, which works 99% of the time.

I have a Loading Scene and a Main Scene.

In the Loading Scene I have a LoadingMono that injects a SignalBus and a FooService. The FooService also injects SignalBus, but its SignalBus is different than the LoadingMono's SignalBus.

I load the MainScene after initing the LoadingMono, the GameObject for LoadingMono is retained instead of destroyed. Loading the Main scene instantiates a number of injected Monos and Services. They all share the same SignalBus as the FooService that was created in the first scene, but none of them share the same SignalBus as the LoadingMono.

The LoadingMono and other Monos have access to the same FooService.

The solution, and oddity, is that if I make a SignalBusWrapper class to inject into the LoadingMono, instead of directly injecting the SignalBus, everything works fine and everyone is on the global signal bus.

I have a solution, it works, but I have no idea why it works and what the potential problems down the line are, looking for an explanation.

FrontBadger
  • 41
  • 1
  • 4

0 Answers0