Verse Script to Update UI from 00/41 to 01/41

So i have this Puzzle Game Level and i created a UI Widget that shows 00/41 and i have 41 levels and each time u done with the level u walk through a mutator Zone and enter next Level so the UI should change tu current Level then. How do i do this and i am quite new to Verse. Thanks in regards

Hello,

I am fairly new to Verse also, but I can provide a suggestion. There are many ways to approach this - from simple to complex - but I am just going to provide the simplest solution.

Unless you have a specific game mechanic that requires the Mutator, I would use a Volume instead.

You can link up the Volumes to your creative device and subscribe to the exit (or enter) event and trigger your update there.

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
using { /UnrealEngine.com/Temporary/Diagnostics }

game_manager_device := class(creative_device):

    @editable
    VolumeDevice_1:volume_device := volume_device{}

    #... Volumes 2 - 40 here

    @editable
    VolumeDevice_41:volume_device := volume_device{}

    var CurrentLevel:int = 0

    OnBegin<override>()<suspends>:void=

        VolumeDevice_1.AgentExitsEvent.Subscribe(OnVolumeExit)

        # VolumeDevice 2 - 40

        VolumeDevice_41.AgentExitsEvent.Subscribe(OnVolumeExit)

    OnVolumeExit(Agent:agent):void=

        set CurrentLevel = CurrentLevel + 1

        #Update your widget here with CurrentLevel

This example is extemely verbose, there are other ways to approach this, Tags being an option. But if you are very new to Verse and just want to get it to work, the code provided will hopefully point you in the right direction.

-dev