Skip to content
This repository has been archived by the owner on Nov 7, 2022. It is now read-only.

Unsubscribers from events #34

Closed
EgorBo opened this issue Jul 30, 2015 · 1 comment
Closed

Unsubscribers from events #34

EgorBo opened this issue Jul 30, 2015 · 1 comment

Comments

@EgorBo
Copy link
Member

EgorBo commented Jul 30, 2015

There are lots of typed subscribers defined in UrhoObject\Object.Events such as:

SubscribeToUpdate
SubscribeToPostRenderUpdate
SubscribeToNetworkMessage

But there is no mechanism to unsubscribe from those events. Original samples use the following code:

UnsubscribeFromEvent(E_SCENEUPDATE);

where E_SCENEUPDATE is a StringHash

@migueldeicaza
Copy link
Contributor

This is now possible, when you subscribe, keep the returned token around, and then invoke: Unsubscribe.

Like this:

var token = foo.SubscribeToUpdate (...);

And later:

 token.Unsubscribe ();

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants