Removing custom UI after specific event.

I did it like the example below, but if you want to allow players to join mid-game, you could do it an actor at a time during each players’ first spawn by having an array of player_spawner_device’s and listening to their SpawnedEvents.

var PlayersCustomCanvas: [player]canvas = map{}

 # set UI on all players around at the start of the match
 for (thisPlayer: Self.GetPlayspace().GetPlayers()):
       if (PlayerUI := GetPlayerUI[thisPlayer]): 
           var NewCanvas: canvas = CreateCanvas()               
           PlayerUI.AddWidget(NewCanvas)
           if:
               set PlayersCustomCanvas[thisPlayer] = NewCanvas
          then:
               SetCanvasVisiblity(thisPlayer, true) 

Just looking at what you did, I see a Sleep(0.1) that I have no idea why it’s there and looking at “PlayersUI[0]” I fear that you may be using just the first item of an array which I guess is possible, but is generally not what I’d expect. There are many ways of doing things, so I don’t want to assume my way is the best.

1 Like