UI Editor: Button Activities

UI Editor: Button Activities

Button Activities

Button activities allow us to use interactive elements from our UI to transition from different machine states. In this tutorial, we will create a new button activity to move us from our menu to our game state.

Transcript
Hi everyone, my name is Ren from Quicksave Interactive. In this tutorial, we will be discussing button activities. What are button activities? Button activities are activities which can be used to give functionality to your UI’s interactive button elements. Such as, firing events. that can transition us from one machine state to another. Let’s dive into the machine editor and create a button activity. In our machine editor, we will go to our machine setting panel and find a section called button activities. I will add a new item. This will give us an empty button activity. You can name your activity anything you please, but I will call this button press. For the layout, I will use the main layout. And the element comes from our UI layout, which has a start button node. So I will use the start Button node. Now as for the event, I want this button activity to transition us from our menu state to our game state, and you might have remembered that we have created this game event here which transitions us from our menu state to our game state. So I will use the game event. event for our button activity. Next, we must attach our button activity to our menu machine state. Since the start button only exists in our menu machine state, it makes sense to add our button activity here. I will go to the activities section and add a new item. This item will be our button activity. Now if I were to go to our view panel and click on our start button, you will see that it plays our UI trigger event animation and it transitions us from the menu state to the game state. If I were to return and do it again, we have the same result. Button activities are a common interactive element of any UI, and thanks to the Machine Editor, we can visualize how a button activity transitions us from one state to the next. In our next video, we are going to show you how to make a button activity in the game state. video, we will review a best practice and discuss the destruction of button activities. Thank you for watching, see you again next time.

Button Activity Practices

When creating activities, it’s important to keep in mind the best practices within the Machine Editor and consider how the Machine operates when entering or exiting a state.

Transcript
Hi everyone, welcome back. In this video, we will take a look at a best practice and the destruction of button activities. Let’s go to our machine editor for an example. In our last video, we placed the button press button activity into our menu machine state. This makes sense since our start button only exists within our menu machine state. But what if we were to place the button press button activity in say the root machine state, since it is also active? Well let’s go ahead and do this. First I will remove the button press activity. activity from our menu machine state and then I will go to our root machine state and add a new activity and now I will add the button press activity here. Now if we were to go to our view panel here you will see that the button still works as expected. expected, but this is not a correct practice. The root state is still active. Therefore, the button press button activity is also still active, even though there is no start button to press, because we are actually in the game state as well, not the menu state. This means that the button is still active. This means that we are using unnecessary resources in the background to have this button press activity active. This can also create complications of blocking UI where there is an invisible button that exists somewhere here. Additionally, it doesn’t make sense to have the button press active. exist within the root state and in the game state because the button press activity transitions us to the game state. There is no need to transition us to the game state when we’re already in the game state. So, the best practice here would be to keep your button activities where they make sense and where their UI buttons exist. As previously mentioned in our event activities tutorial, the quicksave toolkit Machine Technology performs an automatic cleanup when we’re transitioning between states. This means once we exit this menu state into our game state, this button-press activity no longer is active and running. Therefore, we are not using any unnecessary resources as long as the state the activity exists within is not active. The quicksave toolkits optimizations and best practices will ensure that your game runs smoothly and consistently for your players. I highly encourage that you follow these practices and make rational decisions when adding your activities to the machine editor. I also highly recommend that you subscribe to the Quicksave YouTube channel and stay up to date with my new videos. date with our documentation website where you can find more tutorials just like this. Thank you for watching, see you again next time.