As the title suggests, variables do not appear to revert to default values when a new round is launched.
This could be because I’m manually clicking “end game” and the end game state is not being triggered through game settings or a device, as I don’t see my log for the OnEnd function when doing so.
Thinking about this, it would be beneficial in some circumstances to keep variables persistent for the entire game, but the default functionality should reset everything upon a new round.
I may be missing something here, so please correct me if I’m wrong.
Thanks for the bug report. I tried to reproduce your issue with a simple script, but wasn’t quite able to:
using { /Fortnite.com/Devices }
using { /EpicGames.com/Temporary/Diagnostics }
using {/Verse.org/Simulation}
device_script_log := class(log_channel){}
# Your new device script
my_device := class<concrete>(creative_device):
DeviceScriptLog:log = log{Channel := device_script_log}
@editable
var myprop:int = 5
OnBegin<override>()<suspends>:void=
loop:
Sleep(2.0)
set myprop += 100
DeviceScriptLog.Print("{myprop}")
When I end the game via hitting [Esc] and selecting [End Game], then clicking play again, I see the first value being printed out as 105 as expected. Are you ending the game a different way?
If you are able to reproduce this in an isolated example, could you please share your full Verse script?
Interesting, you use @editable before creating a var. Is this standard practice? If so, why?
@editable is a specific attribute for UEFN that allows for a Verse-authored device to expose variables to the editor to allow for control within the UI. Please see: