ExtendRealityLtd / Zinnia.Unity

A collection of design patterns for solving common problems.
http://vrtk.io
MIT License
319 stars 38 forks source link

Allow the Payload in the Proxy Emitter to be publicly set #501

Closed thestonefox closed 4 years ago

thestonefox commented 4 years ago

The simplest solution would be to serialize the Payload property and make the setter public

https://github.com/ExtendRealityLtd/Zinnia.Unity/blob/master/Runtime/Event/Proxy/SingleEventProxyEmitter.cs#L17

This would then allow the Payload to be set in the editor or via code/unity events and then simply calling the existing EmitPayload() method would emit this set payload.

This would allow something to set the payload and then to emit the payload at a later stage such as with a countdown timer.

thestonefox commented 4 years ago

@bddckr @fight4dream do you have any thoughts/input on this idea?

bddckr commented 4 years ago

Seeing your discussion on Slack I think this works fine, just with the raised issue of not being able to reuse this for multiple "remember and emit later" use cases without having to create multiple instances of this object.

But I think for that your suggestion of writing your own thing in the first place to do that in a more direct way is valid.

thestonefox commented 4 years ago

Yeah, we don't wan to turn the emitters into a queuing system.

This is purely just so you can use the emitter to set and emit on your terms.

fight4dream commented 4 years ago

I am welcoming this addition

thestonefox commented 4 years ago

in master now