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.
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.