Hello there!
In my code I’m subscribing another function when a player counter device fails counting:
set UnsubscribeRoundStart = option {CheckIf1Player.CountFailsEvent.Subscribe(RoundStart)}
It’s subscribing the RoundStart
function:
RoundStart() : void =
Print("Round has started")
StatusPlaying.Show()
StatusStopped.Hide()
ChooseRandomSong()
spawn {ChooseRandomDuration()}
if (RoundStartFunction := UnsubscribeRoundStart?):
RoundStartFunction.Cancel()
set UnsubscribeRoundStart = false
In the last lines it should unsubscribe the function, but it doesn’t for some reason. When calling this function for example a 2nd time it’s doing everything thats included in the function twice. I also have a variable in my code: var UnspawnRoundCheck:?cancelable = false
Anybody have an idea what I’m doing wrong here?
Greetings!