Everhood and Scriptable Objects (Unity)
Intro
In the last devlog about Everhood code architecture, I've mentioned that we use scriptable objects. Let's see what is a scriptable object and how we use them!
What is a Scriptable Object?
A Scriptable Object is a non-monobehaviour class that can be created with CreateAssetMenuAttribute and stored in your project folder. Their main intention is to store data.
The excellent thing about them is that the data stored can be accessed anywhere in the game.
Also, Scriptable Object class empowers you to create multiple instances,this is very useful for things like item stats.
Test it by yourself!
using System.Collections; using System.Collections.Generic; using UnityEngine; [CreateAssetMenu(menuName = "Examples/Item")] public class ItemExample : ScriptableObject { public Sprite itemSprite; public float itemCost; public float itemDamage; }
How we use them in Everhood
In our game, we use them as data storage to keep things like settings and player save data.
Our main use case is battle projectiles, we store stats like velocity, damage, and visuals.
Player health is also a scriptable object, this way, all classes that need to know the current player health just need a reference to this scriptable object.
As well, we use them for scene transitions, mainly to have multiple types of fade in and fade out and to be able to create unprecedented scene transitions.
We use them for countless more things, but unfortunately, we have to conclude here, I don't want to spoil anything ;)
Useful links
Architect your game with Scriptable Objects
Game archictecture with Scriptable Objects
Overthrowing the MonoBehaviour Tyranny in a Glorious Scriptable Object Revolution
//Jordi
Wishlist us here so you don't miss any news:
Get Everhood
Everhood
Status | Prototype |
Author | EverhoodDev |
Genre | Adventure, Rhythm, Role Playing |
Tags | 2D, Experimental, Music, Mystery, Pixel Art, Top Down Adventure, Undertale |
Languages | English |
More posts
- Everhood is OutMar 07, 2021
- EVERHOOD RELEASE DATE ANNOUCEMENTFeb 01, 2021
- The divine moments of creativityJan 27, 2021
- A look back into the dark timesJan 20, 2021
- Testing, fixing, testing and testingDec 30, 2020
- Hectic weeks and some thoughts!Dec 09, 2020
- Time to start wrapping up the game again!Nov 18, 2020
- Game engine version change and just polish, polish, polishOct 30, 2020
- Lot of work right now!Oct 09, 2020
- Yet another postSep 25, 2020
Leave a comment
Log in with itch.io to leave a comment.