I have been trying .Cancel() but is not working at all
PickUp1_Spawn.VehicleDestroyedEvent.Subscribe(StartCountdown_PickUp).Cancel()
I have been trying .Cancel() but is not working at all
PickUp1_Spawn.VehicleDestroyedEvent.Subscribe(StartCountdown_PickUp).Cancel()
You need to save the object returned by the subscribe and call cancel on that.
# Implemented by classes that allow users to cancel an operation. For example, calling
# `subscribable.Subscribe` with a callback returns a `cancelable` object. Calling `Cancel`
# on the return object unsubscribes the callback.
cancelable<native><public> := interface:
# Prevents any current or future work from completing.
Cancel<public>()<transacts>:void
Adding solution with @Megaspace code
var OurCancelable:?cancelable = false
OnBegin=
L_Cancelable:cancelable = PickUp1_Spawn.VehicleDestroyedEvent.Subscribe(StartCountdown_PickUp)
set OurCancelable = option{L_Cancelable}
SomeCancelFunction():void=
if (Subscription := OurCancelable?):
Subscription.Cancel()
This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.