How to unsbuscribe an event?

I subscribe an event:
CreatureManagerDevice.MatchingCreatureTypeEliminatedEvent.Subscribe(OnCreatureManagerDeviceMatchingCreatureTypeEliminatedEvent)

and now i want to unsubscribe, how to do it?

I tried:
CreatureManagerDevice.MatchingCreatureTypeEliminatedEvent.Subscribe(OnCreatureManagerDeviceMatchingCreatureTypeEliminatedEvent).Cancel()

But does’t work.

You need to store the event somewhere before :

# This is an example I use in my island
for(MutatorZone : MutatorZones):
    Event := MutatorZone.AgentEntersEvent.Subscribe(OnAgentEnter)
    set SubscribedEvents += array{Event}

# Later in another block
for(Event : SubscribedEvents):
    Event.Cancel()

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.