GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - codesafe/UnitySingleton: The best way to implement singleton pattern in Unity.

BranchesTags
Open more actions menu
 
 

Latest commit

 

History

16 Commits
16 Commits

Folders and files

NameName
Last commit message
Last commit date
Assets
Assets
 
 
Logs
Logs
 
 
Packages
Packages
 
 
ProjectSettings
ProjectSettings
 
 
UserSettings
UserSettings
 
 
.gitignore
.gitignore
 
 
.vsconfig
.vsconfig
 
 
LICENSE
LICENSE
 
 
README.md
README.md
 
 

Repository files navigation

Getting Started Features License Resources Download

Unity Singleton

The best way to implement singleton pattern in Unity. By using this pattern you will be able to define Global variables and classes and use their methods and properties in Global. This pattern is a must have for most of the games that made using Unity engine.

📖 Learn More about Singleton pattern

Features

  • Works in both Development and Production
  • Instantiates Singleton objects if they aren't available by Lazy Load
  • You can configure fields in the inspector for singleton objects in the preload scene

Getting Started

  • Download the Project.
  • Open the Project in Unity.
  • Create your own Singleton classes by extending the Generic ✨ Singleton ✨ class. 🚀 Check out the example GameManager
  • Attach your singleton classes to the GameManager game object in the _Preload scene.
  • Edit the variables inside the inspector
  • Run the game and enjoy!

Usage

Add using UnityCommunity.UnitySingleton; for using the classes.

  • Use Singleton<T> for plain C# classes.
  • Use MonoSingleton<T> if you want a Scene-based singleton which is not persistent across scenes.
  • Use PersistentMonoSingleton<T> if you want a Global and persistent singleton across scenes.

Download

Run the following command in terminal or command prompt to clone the repository:

git clone https://github.com/UnityCommunity/UnitySingleton.git

Or 🔥 Download the master branch as zip.

Resources

  • 📖 UnityGeek Singleton Article
  • 📖 Stackoverflow Answer
  • 📖 Unity Offical Wiki Singleton
  • 📖 Singleton.cs Gist
  • 📖 Wikipedia

License

MIT @ Unity Community

Made with ❤️ by Unity Community

About

The best way to implement singleton pattern in Unity.

en.wikipedia.org/wiki/Singleton_pattern

Resources

Readme
License
Activity

Stars

0 stars

Watchers

0 watching

Forks

0 forks
Report repository

Releases

Packages

Contributors

Languages

You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.