Player.cs Update() function - whats the point to have lastToggle up there?

Hi all,
The moment at 12:05
Can anyone please explain me why we need to use lastToggle var in Update function?

“else” part there makes no much sense for me because it seems run only if reSpawn is set to false coz lastToggle itself never set to true anywhere.
If so, what the point to have lastToggle = reSpawn; ? lastToggle is already and always false.

I tried to think this is done to avoid multiple spawns in case lets say user keep pressing that checkbox (reSpawn) for a several frames, but still couldnt get how current implementation help to avoid it.

Thanks in advance!
Den

1 Like

Privacy & Terms