Welcome to my next work update for my work on 310Games’ The Krilling! This week I will be putting some work into another system related to the scenarios I have been working on previously. It will be a menu where the player can see a more expanded view of the tasks they have been performing and their overall progress.
I start how I have started before, with an empty rect transform prefab for a UI object.
I added an image (separate from the parent object) to serve as a background that we can switch however needed and I added a vertical layout to contain all of the information we want on this page and (with some fine tuning) display it in such a way that everything lines up nicely.
Once the layout group is on an object I can give that object children objects for it to display in the layout. I gave the layout group a set of images that each have some text objects on them as well. These may change but for now provide a proof of concept for the menu as a whole.
These may have to change because right now there are a lot of singular objects that will likely have to become a serialized field or must be fetched with a “getComponent” call. There is also a lot of conditional information that needs to be displayed. After this first pass is complete I will be tackling a lot of these issues, so for this week I focused on making sure this screen would display incrementally how we wanted it and could display some information as a rough draft of what is to come. Next, I will be revisiting the HUD I made previously so I can add a button that will trigger this screen to display (and I will also add a button to this screen to tuck it away again when it is not needed).
HUD Button:
Scenario Menu Button:
The code that runs them (this uses a serialized field of the rect transform parent object from earlier):
As you can see, I am simply changing the position of the anchor of the rect transform when I press the button, so in a sense the panel is always “on”, it’s just whether or not it is on screen or off screen. Opening this menu will also pause the game and closing it will return it back to normal. And, it works!
Now that this basic functionality and layout are in place, it is time to handle the actual information propagation in this menu. The problem is, currently we do not have a very solid idea of the specifics of each scenario, which vastly affects my ability to create UI to display them. After some consultation with a team member, I have decided on making a system where each of the white boxes you can see in the previous video will be its own package that will have a script containing a list of text objects that will then be iterated through and populated as the player completes each scenario.
Here is the initial setup of the script for those chunks of the menu:
However, after setting this script up I ran out of work time for the week as I needed to focus on some other class work. Next week I will finish setting up this menu as we have more work time set up in class than usual.