Player Stasis Bug?

Please select what you are reporting on:

Creative

What Type of Bug are you experiencing?

Character

Summary

I have the following statement that does not work:
OnBegin():void=
AllPlayers := GetPlayspace().GetPlayers()
if(Player1Stasis := AllPlayers[0].GetFortCharacter):
Player1Stasis.PutInStasis(stasis_args{})
it does not work, but if I add a Sleep(0.0) before the statement it does work, is this a defect?
OnBegin():void=
Sleep(0.0)
AllPlayers := GetPlayspace().GetPlayers()
if(Player1Stasis := AllPlayers[0].GetFortCharacter):
Player1Stasis.PutInStasis(stasis_args{})

Steps to Reproduce

above

Expected Result

your player goes into stasis on the game start

Observed Result

it does not work unless you add a sleep with 0 value

Platform(s)

UEFN

If players happen to be already in stasis, it will not work I suspect.

Can you print AllPlayers.Length to see if you have any players on begin?

Sleep helps you delay the moment you attempt stasis, so by the time you run it you already have players or their short stasis is already over so you can put them in stasis again.

You might want to use certain events and put this logic in your OnSomeEvent function and also you might want to check if player is in stasis or not before attempting.

1 Like

been encountering the same issue, you just solved my problem!

can confirm, without adding Sleep() before calling PutInStasis() player wouldn’t be affected. Adding Sleep() solved the issue.

EDIT:
turns out this has been an on going bug for awhile

Wow thank you! I was racking my brain trying to figure out why only 1 of my characters was getting frozen when I was trying to freeze both.
Sleep(0.0) saved the day!

Glad you got it sorted! Thank you @latunda :slight_smile: