Journal 135 — Unity App Development, Interactive Map Info Cards with Scriptable Objects

Objective: To create a general info card that goes with an interactive map, and then apply Scriptable Objects

In the last article, I set up the main menu screen and a map screen. In this article, I will lay out a general animal info card, and then set up scriptable objects to fill in the info for other animals.

First, I set up a new info card layout with a background, title, descriptions, image, logo, and a close button.

We can set up a CardView script that will be used to swap out the text and image in each card.

Now, we are ready for Scriptable Objects. These are just data containers that we will add the text and image info to swap out.

Note the Scriptable Object does not inherit from Monobehaviour so it is not attached to a game object. Also note the CreateAssetMenu instructions. This will add a new create item in the Asset menu, as you can see below.

Now, here are all the animal cards filled out, ready for the next step.

We’ll create an array to store all the animal cards for reference.

I will make a new function that will reference the card index for each card (Elements 0 through 5), and I can set that cardNumber when the buttons are clicked on the map.

Now that we have assigned each DisplayCard index to the right button, we can update the card script to assign the text and image based on that card index.

We need to also remember to update the Close Button on the animal card, in order to set the card inactive so we can return to the map view. We also need to add another On Click () event to set the animal card active to view the card information.

Finally, let’s see this in action.

Thank you for your time!

--

--

--

An Engineering Manager consultant who is seeking additional skills using Unity 3D for game and application development.

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

Recommended from Medium

Running your WordPress site in containers — 2018 version

How Trustpilot Tests and Monitors 200 Microservices

Autoscaling your container platform

A Better way to Manage Gradle Build Script

Food for Agile Thought #208

Food for Agile Thought #288

Run Drupal 8 application on Docker

Introduction to Azure Policy

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
Chris Nielsen

Chris Nielsen

An Engineering Manager consultant who is seeking additional skills using Unity 3D for game and application development.

More from Medium

Journal 142 — Unity Project Development, 2.5D Shooter

A Series On Creating Immersive Audio in Unity with Custom Wwise Scripts

Making a RTS game #48: Various fixes, improvements and clean-ups (Unity/C#)

How I used scriptable objects to build a powerup system