#Restart being called twice
1 messages · Page 1 of 1 (latest)
so the new code
Minigame: https://pastebin.com/0fSy8V23
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Valve minigame: https://pastebin.com/E3DzsCTL
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pinpad minigame: https://pastebin.com/s9eBNn08
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
Pin button: https://pastebin.com/YdaKLcwu
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
that's about it
nothing else is related
and the output after canceling a valve minigame
and the output after completing the valve minigame
Okay, so, let's break this down. Gonna add some braces to make it more visible what's happening here
ValveMinigame gets Stop called on it
{
ValveMinigame gets Stop called on it
{
One of the Stops reaches Restart and calls it
}
PinMinigame gets Stop called on it
{
PinMinigame's Stop reaches Restart and calls it
}
The other Valve Stop reaches Restart and calls it
}
PinMinigame gets Stop called on it
{
PinMinigame's Stop reaches Restart and calls it
}
So there's some layering going on and Stop is definitely happening twice on each
yup, twice on each
So it's definitely related to cancelling, since the "Completion" print looks fine.
these are the only methods that i subscribe to the exit event
Player.inputSystem.OnMinigameCancelDo += Stop;
Player.inputSystem.OnMinigameCancelDo += OnPlayerExitInvoke;
private void OnPlayerExitInvoke()
{
OnPlayerExit?.Invoke();
}
and OnPlayerExit
Wait
is just moving the camera back to the player
I got it
not related
Both are using the same Player
This line here is in Minigame
i got ya
so each minigame should have cached it's own player?
This line is run on each of them
nvm class is a reference type so it wouldnt make a difference
So, whenever any minigame starts, it immediately adds its cancel functions to the GameManager's player
And then pressing cancel calls them all
You should only add those listeners when a Minigame actually starts, and remove them when it stops
I can ponder this a bit more later but I have to do some actual day job stuff for a bit
oh yea
i think i got i now in my head
thank you so much for your engagement
just wanted to let you know that you were right and I've managed to fix the issue and refactor my minigame system, so like you said every time i start new minigame i remove all listeners and add just the neccesary ones