Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/JimTheKiwifruit/SimpleSingleton
A simple singleton implementation for Unity in UPM form for easy addition to projects.
https://github.com/JimTheKiwifruit/SimpleSingleton
libraries singleton singleton-pattern unity unity-scripts unity3d
Last synced: 3 months ago
JSON representation
A simple singleton implementation for Unity in UPM form for easy addition to projects.
- Host: GitHub
- URL: https://github.com/JimTheKiwifruit/SimpleSingleton
- Owner: JimTheKiwifruit
- License: mit
- Created: 2019-08-11T03:41:23.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-01-02T10:29:44.000Z (almost 5 years ago)
- Last Synced: 2024-04-24T16:42:18.122Z (7 months ago)
- Topics: libraries, singleton, singleton-pattern, unity, unity-scripts, unity3d
- Language: C#
- Size: 4.88 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
Awesome Lists containing this project
README
# Simple Singleton
A simple singleton implementation for Unity in UPM form for easy addition to projects.
## Installation
In your Unity project open `Packages/manifest.json` and add `"com.jimthekiwifruit.simplesingleton": "https://github.com/JimTheKiwifruit/SimpleSingleton",` to the top of your dependencies:
```json
{
"dependencies": {
"com.jimthekiwifruit.simplesingleton": "https://github.com/JimTheKiwifruit/SimpleSingleton.git",
"com.unity.collab-proxy": "1.2.16",
"com.unity.ext.nunit": "1.0.0",
"com.unity.ide.rider": "1.0.8",
"com.unity.ide.vscode": "1.0.7",
...
}
}
```You can checkout the full docs on UPM dependancies at [https://docs.unity3d.com/Manual/upm-git.html](https://docs.unity3d.com/Manual/upm-git.html)
## Usage
Instead of extending from `MonoBehaviour`, extend from `Singelton` like this:
```csharp
using JimTheKiwifruit.Singleton;public class YourClass : Singleton {
void DoSomething() {
print("Something");
}}
```Now you can access your singleton from anywhere:
```csharp
void DoStuffWithSingletonClass() {
YourClass.Instance.DoSomething();
}
```