Geek Culture
Published in

Geek Culture

What Are Scriptable Objects In Unity?

Scriptable Objects are a great feature of Unity. They allow the storing of data independent from GameObjects, MonoBehaviours, Scenes, and any sort of save file.

Image from Boundfox Studios — Youtube

A Scriptable Object is a data container that you can use to save large amounts of data, independent of class instances. — Unity Documentation

The main use cases for Scriptable Objects are:

  • Saving and storing data during an Editor session.
  • Saving data as an Asset in your Project to use at run time.
Example Scriptable Object

Coding a Scriptable Object:

A Scriptable Object is written similar to a normal monobehaviour. However, it must inherit from the UnityEngine.ScriptableObject base class.

You may choose to add the CreateAssetMenu Attribute too. It makes creating SO instances easier, by adding an entry into the Create menu (Right-Click in Project panel).

Right-click/Create/The string specified for “menuName” in the Attribute
The new Scriptable Object is created in the Project files, and you can set the variables by selecting it

--

--

--

A new tech publication by Start it up (https://medium.com/swlh).

Recommended from Medium

How to use SCRUM to fight procrastination

Summer Internship — Road Map for Engineering(Responsive Website)

Android platform architecture overview

Significant reasons to choose Ionic for crafting Progressive Web Applications!

Honorable Mention at O’reilly’s Architectural Katas - April 2021

Experience of Creating A Full WVD Golden Image

IoT Heart Rate Monitoring with ThingSpeak Platform

Kundane’s algorithm

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
Vincent Taylor

Vincent Taylor

Unity game developer / C# Programmer / Gamer. Australian (Tasmanian) indie games developer for 10+ years. Currently looking for games industry employment.

More from Medium

Pushing Objects in Unity to Complete Puzzles

47 High Quality Plugins on Unity Asset Store-Essential Tools for Unity Developers

OnClick Event in Unity

How to the Layered Lit shader to mix Texture Maps in Unity HDRP