You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I started working with the new Signalbus and stumbled over the following
Fire a signal with:
_signalBus.Fire(new SpecialSignal()) works fine.
But if I move the creation to a factory:
SignalFactory { InterfaceForSignal Create(){return new SpecialSignal();} }
The signal is fired with the static type: InterfaceForSignal instead of the dynamic type SpecialSignalwhich of course means that a subscribe does not work in the Special type.
From what I see in the bus code it looks like the typeof() instead of GetType() here is the reason (SignalBus line: 77):
public void FireId<TSignal>(object identifier, TSignal signal)
{
// Do this before creating the signal so that it throws if the signal was not declared
var declaration = GetDeclaration(typeof(signal.GetType), identifier, true);
declaration.Fire(signal);
}
So question is: Is there a specific reason to fire based on the static type - or can I change that to GetType and open a PR ?
Best regards and thanks for your help
Friedrich
The text was updated successfully, but these errors were encountered:
Hello Zenject team,
I started working with the new Signalbus and stumbled over the following
Fire a signal with:
_signalBus.Fire(new SpecialSignal())
works fine.But if I move the creation to a factory:
SignalFactory { InterfaceForSignal Create(){return new SpecialSignal();} }
The signal is fired with the static type:
InterfaceForSignal
instead of the dynamic typeSpecialSignal
which of course means that a subscribe does not work in the Special type.From what I see in the bus code it looks like the typeof() instead of GetType() here is the reason (SignalBus line: 77):
So question is: Is there a specific reason to fire based on the static type - or can I change that to GetType and open a PR ?
Best regards and thanks for your help
Friedrich
The text was updated successfully, but these errors were encountered: