Forum Discussion

KevinJardine's avatar
8 months ago
Solved

Custom UI unfocus

Is there any way to unfocus a Custom UI using a script so the player does not have to do it themselves? I have a series of UI interactions and after they are over, I want to return the player to the main environment.

  • I got a response to this question on the Discord server and verified it works. And it is easy.

    There is a player.unfocusUI() function.

    So in my UI code I do something like:

    return Pressable({
      onPress: (player: Player) => {    
        this.async.setTimeout(() => {player.unfocusUI()}, 3000);
    }
    });
     
    This enables me to display a response screen for 3 seconds and then I unfocus the Custom UI. 

1 Reply

  • I got a response to this question on the Discord server and verified it works. And it is easy.

    There is a player.unfocusUI() function.

    So in my UI code I do something like:

    return Pressable({
      onPress: (player: Player) => {    
        this.async.setTimeout(() => {player.unfocusUI()}, 3000);
    }
    });
     
    This enables me to display a response screen for 3 seconds and then I unfocus the Custom UI.