Closed cpetry closed 5 years ago
To be more precise: I have several zenjectBinding components with different identifiers. Each gameobject has a script that should use the same signal but with different identifiers. Of course when firing the signals each should call different methods in the end.
Unfortunately no, but now that you mention it that would make sense. You'd just have to pass an optional identifier to BindSignal, DeclareSignal, Fire, and Subscribe methods.
That would be so great! I really would like to use the be signal concept. It's great and easier to use.
Ok I'll take a look before the next release
Then I'll wait till then before I upgrade. Thanks again for your hard work!
Ok added in 7.3.0 and 6.5.0
Well I am able now to declare a Signal with an Id:
Container.DeclareSignal<Signal_UIButtonClicked>().WithId("New");
But I can't bind a signal with an Id to a specific method. Or where would I attach the Id information?
Container.BindSignal<Signal_UIButtonClicked>().ToMethod<ISaveLoad>(x => x.OnNew).FromResolve();
Oops, you're right I forgot to add it to BindSignal.
Fixed on LTS branch and merging to master soon
Hi again,
I now fetched the newest version (7.3.0) via unity asset store.
Now I am able to Resolve the ID correctly:
_signal = container.ResolveId<Signal_UIButtonClicked>(_identifier);
But I now cannot declare and bind the signal with an ID.
Why can't you use WithId like you did previously? Also you should not be able to resolve a signal using container.ResolveId<Signal_UIButtonClicked>(_identifier);
. With the new system, signals are temporary parameter objects and are not added to the container
Strange. Okay I'll check if I updated Zenject correctly.
you are right. After I reinstalled the unityPackage from the release page here, everything was as expected.
One last thing:
I can't bind a signal to a bound class with Id.
I would like to do it like this:
Container.BindSignal<SomeSignal>().ToMethod<IMyClass>(x => x.DoSomething).FromResolve("SomeID");
But there is no possibility to get the resolve with ID.
Use From instead and put From resolve inside it
With the previous Signals concept it was possible to bind the signal to an interface with an Id. Is there an alternative in the new signals concept?