met44 / uStableObject

Unity3D ScriptableObject based architecture framework
MIT License
9 stars 1 forks source link
csharp framework game-development scriptableobject unity3d

uStableObject, when 1 / reacts

Unity3D ScriptableObject based architecture framework.

ScriptableObject based architecture simplify wiring elements and systems together while also bringing the benefits of decoupling. It can also ease sharing data accross scenes in a simple, clean, generic an reliable way.

No more fiddly unappliable cross prefab references in scene objects, everything pings pongs through your defined assets. Never suffer from a broken reference again !

Getting Started

GameEvent

Creating a GameEvent

Creating a GameEvent listener as an asset (lives in project)

Creating a GameEvent listener as a MonoBehaviour (lives in scene)

Creating a GameEvent listener as a Wrapper (for use from pure C# classes)

Firing a GameEvent

Vars

Vars store data of the specified type, and also act as a GameEvent of that type. For exemple setting myBoolVar.Value = true; will also fire the GameEvent as if calling myBoolVar.Raise(true) on a bool event

Vars work with standard GameEvent listeners, but also have a specific type of listener called Watcher that also fires the value when the object is enabled.

Ordering

Experience using USO tells that when ordering appears to be needed in between listeners to an event, that event isn't specific enough and should be broken in smaller pieces, thus effectively replacing ordering by a better event chain definition.

For example, a StartGame event fired when arriving in the game scene could be split up into SceneFinishedLoading and then StartGame to allow preparing things before actually starting the game.