Creating Scriptable Objects to Fill a Panel

Jordan Evans
3 min readDec 29, 2021

--

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.

--

--

No responses yet