I have encountered this issue twice now, and only since the 28.10 update, where using Sleep() will just stop execution completely.
Hi George,
Is this issue reproducible?
Paste a snippet and I’ll give it a check. I’ve had issues with Sleep() at 0.0 or small sleep values in the past.
Also consider posting repro steps in this category as a ‘New Issue’ (as opposed to ‘New Discussion’) so it can potentially be entered into the bug tracking database.
(Edit: Tested with smaller example and issue still occurs so updating snippet)
It is reproducable although I’m not sure exactly what’s causing it. Whenever I’ve encountered it I’ve been forced to use the Timer device as a workaround.
Here is a snippet where I’m encountering an issue.
OnHitEnemy(Player : player):void=
{
spawn{SleepNotWorking()}
}
SleepNotWorking()<suspends>:void=
{
Print("Sleep starting")
Sleep(1.0)
Print("Sleep finished") #This never gets hit
}
Below is the log showing that the line after Sleep never gets hit. I think this might be a general issue with Suspend<> as I tried waiting for MoveTo as a workaround that led to the same problem. It’s strange because Sleep is used elsewhere in the project and it works as expected.
Thanks for that.
I’m still a Verse novice, so not really sure how to proceed with troubleshooting, but it did function normally after a small change.
using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }
sleeptest := class(creative_device):
@editable
MyButtonRef : button_device = button_device{}
#changed from player to agent
OnHitEnemy(Agent : agent):void=
{
Print("Function hit")
spawn{SleepNotWorking()}
}
SleepNotWorking()<suspends>:void=
{
Print("Sleep starting")
Sleep(1.0)
Print("Sleep finished") #This never gets hit
}
OnBegin<override>()<suspends>:void=
MyButtonRef.InteractedWithEvent.Subscribe(OnHitEnemy)
That’s interesting, I don’t see how that would make a difference as Player is derived from Agent, and it’s not even being used there anyway.
I did also have the issue when I was spawning a method that didn’t have any arguments passed in, and this was working before the latest update which is what makes me think it’s related.
Agreed that it shouldn’t make a difference.
Hmm, the print after sleep still prints with an argumentless method in this case.
OnHitEnemy():void=
{
Print("Function hit")
spawn{SleepNotWorking()}
}
SleepNotWorking()<suspends>:void=
{
Print("Sleep starting")
Sleep(1.0)
Print("Sleep finished") #This never gets hit
}
OnBegin<override>()<suspends>:void=
OnHitEnemy()
I wonder if it’s related to the size of the project, maybe Verse restricts the amount of concurrent tasks that can be run at once. It’s just strange how the issue seems to be almost completely random haha