01
Overview
Smart Variables is a system for Unity based on a talk about game architecture by Ryan Hipple. It lets you connect scripts to each other through Scriptable Objects, in a modular and convenient way.
The system is used in and developed alongside Jello. It has proven itself to be very useful, and at this point I feel it's ready for anyone else to use.

02
Adding it to a project
Smart Variables is a Unity package, so it goes into a project through the Package Manager with its git URL.

03
Variables live in assets
A variable is stored as an asset in the project. A component defines a reference to it in code, and in the inspector it is pointed at the asset, so any number of components can read and write the same value without knowing about each other.

04
Persistence and debugging
Because the variables are stored in assets, they can be persistent. With a simple switch, a variable stays the same between play sessions and scene loads.
For easy debugging, a debug log toggle prints every change that happens to the variable.
For persistence in builds, a variable saver can be assigned to variables. It serializes their values to binary files and handles saving and loading.

05
Local collections
Imagine you want multiple players, and therefore a health value for each one. Duplicating variables stored in assets would be quite cumbersome.
For that use case there are local collections, where the variables are stored in a component on an object. Unlike variables stored in assets, these are duplicated together with the object.

06
Smart variables
The variables described above I call smart references. On top of them is a system of smart variables, which, unlike smart references, can also be set to behave as regular public variables.