|
1 |
| -# UnitySingleton |
| 1 | +| [Getting Started](#getting-started) | [Features](#features) | [License](#license) | [Resources](#resources) | [Download](#download) | |
| 2 | +|-------------------------------------|-----------------------|---------------------|-------------------------|-----------------------| |
| 3 | + |
| 4 | +# Unity Singleton |
| 5 | + |
2 | 6 | The best way to implement singleton pattern in Unity.
|
| 7 | + |
| 8 | +By using this pattern you will be able to define Global variables and classes and use their methods and properties in Global. |
| 9 | + |
| 10 | +This pattern is a must have for most of the games that made using Unity engine. |
| 11 | + |
| 12 | +## Features |
| 13 | + |
| 14 | +- Works in both Development and Production |
| 15 | +- Instantiates Singleton objects if they aren't available by Lazy Load |
| 16 | +- You can configure fields in the inspector for singleton objects in the preload scene |
| 17 | + |
| 18 | +## Getting Started |
| 19 | + |
| 20 | +- [Download the Project](#download). |
| 21 | +- Open the Project in Unity. |
| 22 | +- Create your own Singleton classes by extending the Generic [:sparkles: Singleton :sparkles:](https://github.com/UnityCommunity/UnitySingleton/blob/master/Assets/Scripts/Singleton.cs) class. [:rocket: Check out the example GameManager](https://github.com/UnityCommunity/UnitySingleton/blob/master/Assets/Scripts/GameManager.cs) |
| 23 | +- Attach your singleton classes to the GameManager game object in the _Preload scene. |
| 24 | +- Edit the variables inside the inspector |
| 25 | +- Run the game and enjoy! |
| 26 | + |
| 27 | +## Download |
| 28 | + |
| 29 | +Run the following command in terminal or command prompt to clone the repository: |
| 30 | + |
| 31 | +```bash |
| 32 | +git clone https://github.com/UnityCommunity/UnitySingleton.git |
| 33 | +``` |
| 34 | + |
| 35 | +Or [:fire: Download the master branch as zip](https://github.com/UnityCommunity/UnitySingleton/archive/master.zip). |
| 36 | + |
| 37 | +## Resources |
| 38 | + |
| 39 | +- [:book: UnityGeek Singleton Article](http://www.unitygeek.com/unity_c_singleton/) |
| 40 | +- [:book: Stackoverflow Answer](https://stackoverflow.com/questions/35890932/unity-game-manager-script-works-only-one-time/35891919#35891919) |
| 41 | +- [:book: Unity Offical Wiki Singleton](http://wiki.unity3d.com/index.php/Singleton) |
| 42 | + |
| 43 | +## License |
| 44 | + |
| 45 | +MIT @ [Unity Community](https://github.com/UnityCommunity) |
| 46 | + |
| 47 | +Made with :heart: by [Unity Community](https://github.com/UnityCommunity) |
0 commit comments