Please select what you are reporting on:
Verse
What Type of Bug are you experiencing?
Verse
Summary
Game Crashes when passing in a cancelable to a function. Crashes on game start but not if only verse changes are pushed, meaning if you have a game running and then push verse changes with the code that crashes the game, it wont crash until you push changes all changes.
Heres the code that crashes my game:
startMinigame() : void =
Print("")
if:
Agent := agent[Player]
PlayerUI := GetPlayerUI[Player]
then:
PlayerPlot := getPlotFromAgent(Agent)
MinigameCanvas := CreateMinigameCanvas()
PizzaCanvas := canvas{}
set GlobalCatcherCanvas = CreateCatcherCanvas()
if(realPlot := PlayerPlot?):
realPlot.RightInput.Register(Agent)
realPlot.LeftInput.Register(Agent)
Cancleable1 := realPlot.RightInput.PressedEvent.Subscribe(onClickedRight)
Cancleable2 := realPlot.LeftInput.PressedEvent.Subscribe(onClickedLeft)
PlayerUI.AddWidget(MinigameCanvas, player_ui_slot{ZOrder := 0})
PlayerUI.AddWidget(PizzaCanvas, player_ui_slot{ZOrder := 2})
PlayerUI.AddWidget(GlobalCatcherCanvas, player_ui_slot{ZOrder := 1})
spawn{updateMinigame(PizzaCanvas,MinigameCanvas, Cancleable1, Cancleable2)}
updateMinigame(Canvas : canvas, MinigameCanvas : canvas, Cancelable1 : cancelable, Cancelable2 : cancelable)<suspends> : void =
var speed : float = 5.0
race:
block:
loop:
Sleep(0.0)
set speed *= (1.0+0.0005)
for(Widget : FallingWidgets, StopGame <> true):
tickWidget(Widget, Canvas, speed)
if(StopGame?):
for(Widget : FallingWidgets, TextureBlock := WidgetData[Widget].TextureBlock):
Print("Started Blincnation")
spawn{Blink(TextureBlock, MakeColorFromHex("#FF0000") , ?Speed := 1.0, ?Times := 5)}
spawn{ExitGame(MinigameCanvas, Canvas, 5.0)}
Cancelable1.Cancel()
Cancelable2.Cancel()
break
block:
var SleepTime : float = 2.0
loop:
Sleep(0.0)
addFallingWidget(GetRandomInt(1, 3))
Sleep(SleepTime)
if(SleepTime > 0.3):
set SleepTime *= (1.0-0.03)
Keep in mind the game crashes even if the code is not run
Steps to Reproduce
Boot game in editor with a function that passes in cancelables
Expected Result
Game crashes
Observed Result
Game crashes
Platform(s)
PC