Creating Scriptable Objects to Fill a Panel

Let’s take a dive into how we can go about create scriptable object’s that will allow us to produce a modular approach to fill in some information on a panel. This will help speed up the process in which we create out panels, as if we had to create a dozen or so panels, we don’t need to go through the process in which we have to set up each individual panel. To start, let’s make a quick map that would be one that you would see at a zoo:

Each of these locations is will be a button that will open up a new panel that will give the user a small amount of information that they can read regarding the specific exhibit. Next, we can go about and create each panel on it’s own and have it look like so:

However, this will involve having to be sure we are setting up asset within the panel properly. Sure, one could just duplicate the panel and enter in the proper information for the new panel, but that would be a lot of extra work when we can just use 1 panel and have the data populate upon us opening it up. First off, let’s take a look at creating a new scriptableobject within script that we can choose within our asset menu:

This will allow us to input the information we need into our panel within our unity editor, and cut out the process of having a bunch of panels to work with:

From here, we will want to create a script that we can attach to our card panel that will let us designate where exactly we would want the information that we create be placed:

On top of having all of our text and image objects we can attach the components to within the panel, we are also creating a method in which when we select this option, we can assign a number to our button that corresponds to the element each exhibit we have set up in our array. Once we have filled out all of the information in the array, we can go ahead and set our buttons up to have that particular number and enable the card panel:

Finally, we will want to have our close button actually work, so let’s quickly have it close the card panel by making the setactive set to false:

With all of this set up, let’s see if what we have set up works as intended:

With that, we have figured out how we can work with scriptable objects within Unity and how it makes the job much easier, along with a lot less intensive towards a device as we are not having to create panels for each individual object.




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

Recommended from Medium

Using EC2 to create a microservice

mabl as Your Pair Testing Partner

OceanBase Breaks TPC-C Record: A Dialogue with Ant Financial Experts

git2consul alternatives: key-value filesystem syncing for Consul

Go Channels — Behind the Scenes

Go Channels

SWRL with Professor Bernardo Cuenca Grau

Connected app in Salesforce for absolute beginners

Salesforce Session Id in cookies

Reporting System: Everything You Need to Know

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
Jordan Evans

Jordan Evans

More from Medium

Connecting our Information and Working with Maps

Improving Upon Selection Highlighting in Our Game — Part 1

Daily Progression: Player Setup!

New Input System with Unity Learn — Lesson 1