https://github.com/bengreenier/unity-fucking-singletons
A framework of patterns for avoiding antipatterns in Unity
https://github.com/bengreenier/unity-fucking-singletons
unity-scripts unity3d
Last synced: over 1 year ago
JSON representation
A framework of patterns for avoiding antipatterns in Unity
- Host: GitHub
- URL: https://github.com/bengreenier/unity-fucking-singletons
- Owner: bengreenier
- License: mit
- Created: 2017-12-13T01:09:42.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-12-13T02:24:26.000Z (over 8 years ago)
- Last Synced: 2025-03-24T18:52:25.800Z (over 1 year ago)
- Topics: unity-scripts, unity3d
- Language: C#
- Homepage:
- Size: 164 KB
- Stars: 15
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Fucking Singletons
A framework of patterns for avoiding antipatterns in Unity

Inspired heavily (entirely) by [Ryan's talk](https://www.youtube.com/watch?v=raQ3iHhE_Kk) at Unite 2017, this is a framework that provides some tools that make writing better game code easier.
## Background
This framework depends heavily on ScriptableObjects to make things work. As such, you should have an understanding of what those are! The best way to get that understanding is likely from [this video](https://unity3d.com/learn/tutorials/modules/beginner/live-training-archive/scriptable-objects).
## API
> Current version is `0.1.0`
These are the "tools" that the framework provides :tada:
### SOObject
> Abstract class
A `SOObject` represents some primitive type as a scriptable object. It's effectively a data wrapper.
### SOBool
A primitive wrapper, wrapping a boolean value.
### SOFloat
A primitive wrapper, wrapping a float value.
### SOInt
A primitive wrapper, wrapping an int value.
### SOString
A primitive wrapper, wrapping a string value.
### SOReference
> Abstract class
A `SOReference` provides an abstraction layer for your systems - enabling them to work on data represented as `SOObject`s, or as constant values.
### SOBoolReference
Abstraction representing either a `SOBool` or a boolean constant.
### SOFloatReference
Abstraction representing either a `SOFloat` or a float constant.
### SOIntReference
Abstraction representing either a `SOInt` or an int constant.
### SOStringReference
Abstraction representing either a `SOString` or a string constant.
### SOEvent
A `SOEvent` represents an event that can be raised, and a collection of listeners that will be notified in the event that it is, in fact, raised.
#### Raise
Raises the event (optionally with parameters)
#### RegisterListener
Registers a listener
#### UnregisterListener
Unregisters a listener
### SOEventListener
A `SOEventListener` represents the response to a `SOEvent` - namely the action(s) to take when it is raised
### SOSet
A `SOSet` represents a collection of items.
#### Items
Returns the child items
#### GetChildCount
Returns the count of the child items
#### Add
Adds a child item
#### Remove
Removes a child item
### GameObjectSOSet
A set wrapper for storing `GameObject`s
#### GameObjectSOSetElement
A runtime helper for adding `GameObject`s to a `GameObjectSOSet` - this enables runtime population of a set
### Metadata
Contains information about the framework (like version, editor tooling information, etc)