Enterprise Apps: Zoo App Part 3

Objective: Scriptable Objects in Unity

To get ready for the scriptable object, we start out with a new panel. The Card Panel will represent each exhibit of the zoo and get filled dynamically. The panel is made up of UI Text and Image elements and a Close Button.

The next step is to create a CardView script and create the associated variables.

Next for the scriptable object we create a CardModel script that inherits from ScriptableObject and again create the associated variables. We use this script in setting up a CreateAssetMenu for a Card.

As you can see we can now populate the card models inside the inspector for each of the designated sectors of the Zoo.

Next we create a CardModel array for the Cards and set them in the inspector based on the buttons associated with each sector.

We can then use a DisplayCard method that takes an integer input which related to the card and assigns the values set to the CardPanel.




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