Creating Menu-Driven Applications for Enterprise Solutions in Unity

Finagling Forms, Function and Flow

My current project is an app for reporting and retrieving insurance claim information. I’ll wait while you contain your excitement.

Contain it!

Okay, so as dry as the topic seems, there’s some fun things to learn here.

What we want to achieve is the ability to navigate seamlessly through each menu of the app using buttons. Eventually, there will be C# logic under the hood handling the data we enter into the forms of the app, but for now we’re going to handle the main program flow using just the Unity Editor.

Let’s go through this step-by-step.

UI Panels

The first thing we need are the various screens. We’ll set these up as UI Panel objects in the Hierarchy, with each progressive panel lower in the Hierarchy than (and therefore rendered on top of) the previous panels.

My panels are made with premade tutorial assets, but you can follow along with this exercise without them. I won’t be covering creating and arranging UI elements themselves — I’ve covered those details in a previous article.

If I look at the navigation flow diagram included with my assets I can see there are two main branches of activity, starting on the home page. I can find a case or create a case.

From there each branch develops linearly on its own before both terminate at the Case Overview, which displays the information requested by the first branch or supplied by the second.

In total, I’ll need 10 panels. The flow diagram shows multiple parts to the Overview, but that’s still all going on one screen so it gets one panel. Likewise, the photo taking process is displayed as multiple parts, but that will all occur on one panel as well.

Since the Overview is the odd-panel-out, let’s take a closer look at how to set up that scroll bar. Start by creating a UI Scroll View object:

You can delete the image component on the Scroll View object, as well as the Scrollbar Horizontal child object. Then, resize the Scroll View to fill the content area.

Now I can put the Case Overview Panel with all its content as a child of the Viewport object within the Scroll View. This will drop the content neatly into the scroll view, and allow the scrollbar to control the position of the content.

When all my panels are created I can disable all of them except the main panel. Then my hierarchy should look like this:

Navigation Button Actions

Now we need to get these buttons working. Select the first button on the main screen — the “find” button. In the Button component, add a new OnClick event. Drag the next panel in the Find A Claim branch into the space provided. In the dropdown, select GameObject > SetActive and check the box for “True.”

I also have some border graphics that appear on all the other menus other than the main menu, so I’ll need to activate that panel as well.

Repeat this process for each panel and navigation button. Don’t worry about the buttons on the bottom of the screen just yet — that will come later.

When you’re ready, test it out and see what you’ve got:

Nice and easy.

I’m going on hiatus while I venture into the deep reaches of a mountain forest. When I get back I’ll be writing about integrating the Google Maps API into the project so we can collect location data.

--

--

--

Unity Developer / Game Developer / Artist / Problem Solver

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Learning Printf() in C/c++ Is Not Difficult At All!

How to uninstall Applications/Software packages in Ubuntu

Scraps of used paper lying inside and outside a trash bin

Python Dictionaries are Ordered now, but how?…and why?

ENS Registry Migration Is Over… Now What? A Few Things to Know

Spinning up an EC2 Instance and VPC via CloudFormation

How to Play Sound Effects in Unity

DNS Server with Webmin

C++ Median Filter

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Micha Davis

Micha Davis

Unity Developer / Game Developer / Artist / Problem Solver

More from Medium

Journal 136 — Unity App Development, AR using Vuforia

Saving Data in Unity3D Using Files

Creating an Online TicTacToe game using WebSocket | Ktor- Part1

From Prototyping to Production: 3 Rules You Should Always Apply