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

Confronting pandemic, building community

How do you see The Graph protocol and subgraphs evolving in the future?

18 Plugins for Writing Python in VS Code

Model View Controller in Harbour

Linux Quick Start Guide

How to install Git

Test Automation: Identifying Objects in a Web Page

Configure LB(haproxy) using Ansible-Roles on AWS.

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

Adding Reflection Probes in Unity

What is a Control Track in Timeline

Aiming Features in Cinemachine

Create A White Noise Shader With Shader Graph In Unity