Scriptable Objects- App Dev Series 14

Quick guide: create a scriptable object as template to show relative content.

When creating multiple objects with same interface design, it would be faster on building if creating a template to them.
In this article, we will create a template called Scriptable Object and apply it to all of targets.

Scriptable object script

In this article, I would create a guiding map of zoo which would display the information of animal when user click on the area name.

Before creating the scriptable object, you should have a script to control the elements of your animal introduction card, which would be imported the relative contents later.

This would be the origin script to control the element on card.

First, let’s create a script and name it CardModel as template script.
Inside this script, we would use all elements that needed to an animal intro card.

Once created all the variables, turn this script into a ScriptableObject by using ScriptableObject to replace MonoBehaviour.

After finished this, make this script can be created as a new object in Unity by adding one line.
Using CreateAssetMenu to enable adding new object to game.

Back to editor, and when you right click on Project window and select Create. There should be an option called Cards.

And it should create an object that allow you to input the data from what we created in script.

With this object template, you can input any information easily and apply the content from it to your app.

--

--

--

A passionate gamer whose goal is to work in video game development.

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

Recommended from Medium

Types of Automated Testing Frameworks

Introducing IndieDojo: the bootcamp for indie hackers & bootstrappers

(W&M)Best Python IDE for web development and Data science

WeSendit Airdrop: The biggest Giveaway

WeSendit Airdrop: The biggest Giveaway

Kotlin Coroutines [Part-2]

Quick Sort + Greedy first, then Compress Array technique for 01 knappack (Max value that it can…

district0x Dev Update - September 29th, 2020

Learning on the job versus learning in the classroom — what I’ve found trying both. Part 2

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
S.J. Jason Liu

S.J. Jason Liu

A passionate gamer whose goal is to work in video game development.

More from Medium

New Input System and UI

Daily Progression: Generate a Case Number!

Creating An Advanced 2D Player Controller Without Any Unity Components! (Part 1)

Day 105: Working with Animation Events in Unity