├── Runtime
├── Scripts
│ ├── ISingleton.cs.meta
│ ├── Singleton.cs.meta
│ ├── MonoSingleton.cs.meta
│ ├── PersistentMonoSingleton.cs.meta
│ ├── ISingleton.cs
│ ├── PersistentMonoSingleton.cs
│ ├── Singleton.cs
│ └── MonoSingleton.cs
├── Scripts.meta
├── UnityCommunity.UnitySingleton.asmdef.meta
└── UnityCommunity.UnitySingleton.asmdef
├── Samples~
├── Scenes.meta
├── Scripts.meta
├── Scripts
│ ├── Test.cs.meta
│ ├── GameManager.cs.meta
│ ├── SceneTest.cs.meta
│ ├── SceneGameManager.cs.meta
│ ├── Test.cs
│ ├── SceneTest.cs
│ ├── SceneGameManager.cs
│ └── GameManager.cs
├── UnityCommunity.UnitySingleton.Samples.asmdef.meta
├── Scenes
│ ├── Game.unity.meta
│ ├── _Preload.unity.meta
│ ├── Main Menu.unity.meta
│ ├── _Preload.unity
│ ├── Game.unity
│ └── Main Menu.unity
├── SamplesGuideInfo
│ ├── Scripts.meta
│ └── Scripts
│ │ ├── Editor.meta
│ │ ├── Editor
│ │ ├── ReadmeEditor.cs.meta
│ │ └── ReadmeEditor.cs
│ │ ├── Readme.cs.meta
│ │ └── Readme.cs
├── UnityCommunity.UnitySingleton.Samples.asmdef
└── Readme.asset
├── LICENSE.meta
├── CHANGELOG.md.meta
├── README.md.meta
├── CONTRIBUTING.md.meta
├── package.json.meta
├── Runtime.meta
├── package.json
├── LICENSE
├── CONTRIBUTING.md
├── .gitignore
├── CHANGELOG.md
└── README.md
/Runtime/Scripts/ISingleton.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c74da12ece85ed04ab1bd15679da7a4e
--------------------------------------------------------------------------------
/Runtime/Scripts/Singleton.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 84eb48fd76368e04598346d2598c5d6f
--------------------------------------------------------------------------------
/Runtime/Scripts/MonoSingleton.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d1dd8bf5a34f8d44e82ce68fc0929036
--------------------------------------------------------------------------------
/Runtime/Scripts/PersistentMonoSingleton.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c5a25f5168adee44b8aa5522c314a274
--------------------------------------------------------------------------------
/Samples~/Scenes.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7a33e7dcf21d4b4c9b9f058a7c61b34a
3 | timeCreated: 1740108284
--------------------------------------------------------------------------------
/Samples~/Scripts.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ed8313d3d1c1485581e662df6414d08e
3 | timeCreated: 1740108276
--------------------------------------------------------------------------------
/Samples~/Scripts/Test.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 331da87ca46643538dbc0df750b99383
3 | timeCreated: 1740108212
--------------------------------------------------------------------------------
/Samples~/Scripts/GameManager.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d4c34455da4a426fb79fdb00cf3f99b1
3 | timeCreated: 1740108150
--------------------------------------------------------------------------------
/Samples~/Scripts/SceneTest.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: da6211688755485cac17524804aecccb
3 | timeCreated: 1740108184
--------------------------------------------------------------------------------
/Samples~/Scripts/SceneGameManager.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6008d09c07034a338476992dc5791d31
3 | timeCreated: 1740108174
--------------------------------------------------------------------------------
/Samples~/UnityCommunity.UnitySingleton.Samples.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6ae01d2b31cd4efc8e8bff7d2af1c122
3 | timeCreated: 1740109230
--------------------------------------------------------------------------------
/LICENSE.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8548c2c59835a1947b46b3d1a5f08941
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/CHANGELOG.md.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f0e376553447c434496b242ff15d23d8
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/README.md.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8a91ec861a8abb547b8934ca3a3fd16d
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/CONTRIBUTING.md.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 24b5356e887ed9b4c97f35c6691bbec6
3 | TextScriptImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/package.json.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 721d2467222d0fa44bca492aea614254
3 | PackageManifestImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Runtime.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ce805a05ddc963747a4dc94cb43e45af
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/Scenes/Game.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 0ddcff96bc0ef8844abfa8c1f0f5c7a8
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Samples~/Scenes/_Preload.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9a1cca499933f9f47ace2af7e40a5f27
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Samples~/Scenes/Main Menu.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6ea71a6420da64341a3cdd2231fc6e26
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Runtime/Scripts.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6bbedb2a0fe1045428904f242ef23df1
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Runtime/UnityCommunity.UnitySingleton.asmdef.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: de184cc3ec226704b92a2445e8648cf3
3 | AssemblyDefinitionImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/Samples~/SamplesGuideInfo/Scripts.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ff02088bc4508c64895365f91fac63de
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/Samples~/SamplesGuideInfo/Scripts/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3ad9b87dffba344c89909c6d1b1c17e1
3 | folderAsset: yes
4 | timeCreated: 1475593892
5 | licenseType: Store
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/Samples~/Scripts/Test.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | namespace UnityCommunity.UnitySingleton.Samples
4 | {
5 | public class Test : MonoBehaviour
6 | {
7 | void Start()
8 | {
9 | Debug.Log(GameManager.Instance.GetPlayerName());
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/Samples~/Scripts/SceneTest.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | namespace UnityCommunity.UnitySingleton.Samples
4 | {
5 | public class SceneTest : MonoBehaviour
6 | {
7 | void Start()
8 | {
9 | Debug.Log(SceneGameManager.Instance.GetPlayerName());
10 | }
11 | }
12 | }
--------------------------------------------------------------------------------
/Runtime/Scripts/ISingleton.cs:
--------------------------------------------------------------------------------
1 | namespace UnityCommunity.UnitySingleton
2 | {
3 | ///
4 | /// The singleton interface.
5 | ///
6 | public interface ISingleton
7 | {
8 | public void InitializeSingleton();
9 |
10 | public void ClearSingleton();
11 | }
12 | }
--------------------------------------------------------------------------------
/Samples~/SamplesGuideInfo/Scripts/Editor/ReadmeEditor.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 476cc7d7cd9874016adc216baab94a0a
3 | timeCreated: 1484146680
4 | licenseType: Store
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Samples~/SamplesGuideInfo/Scripts/Readme.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fcf7219bab7fe46a1ad266029b2fee19
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences:
7 | - icon: {instanceID: 0}
8 | executionOrder: 0
9 | icon: {fileID: 2800000, guid: a186f8a87ca4f4d3aa864638ad5dfb65, type: 3}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/Samples~/Scripts/SceneGameManager.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | namespace UnityCommunity.UnitySingleton.Samples
4 | {
5 | public class SceneGameManager : MonoSingleton
6 | {
7 | [SerializeField]
8 | protected string m_PlayerName = "NoSLoofah";
9 |
10 | public string GetPlayerName()
11 | {
12 | return m_PlayerName;
13 | }
14 | }
15 | }
--------------------------------------------------------------------------------
/Runtime/UnityCommunity.UnitySingleton.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "UnityCommunity.UnitySingleton",
3 | "rootNamespace": "UnityCommunity.UnitySingleton",
4 | "references": [],
5 | "includePlatforms": [],
6 | "excludePlatforms": [],
7 | "allowUnsafeCode": false,
8 | "overrideReferences": true,
9 | "precompiledReferences": [],
10 | "autoReferenced": true,
11 | "defineConstraints": [],
12 | "versionDefines": [],
13 | "noEngineReferences": false
14 | }
--------------------------------------------------------------------------------
/Samples~/UnityCommunity.UnitySingleton.Samples.asmdef:
--------------------------------------------------------------------------------
1 | {
2 | "name": "UnityCommunity.UnitySingleton.Samples",
3 | "rootNamespace": "UnityCommunity.UnitySingleton.Samples",
4 | "references": [
5 | "UnityCommunity.UnitySingleton"
6 | ],
7 | "includePlatforms": [],
8 | "excludePlatforms": [],
9 | "allowUnsafeCode": false,
10 | "overrideReferences": false,
11 | "precompiledReferences": [],
12 | "autoReferenced": true,
13 | "defineConstraints": [],
14 | "versionDefines": [],
15 | "noEngineReferences": false
16 | }
--------------------------------------------------------------------------------
/Samples~/Scripts/GameManager.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using UnityEngine.SceneManagement;
3 |
4 | namespace UnityCommunity.UnitySingleton.Samples
5 | {
6 | public class GameManager : PersistentMonoSingleton
7 | {
8 | [SerializeField]
9 | protected string m_PlayerName;
10 |
11 | protected virtual void Start()
12 | {
13 | SceneManager.LoadScene("Main Menu");
14 | }
15 |
16 | public string GetPlayerName()
17 | {
18 | return m_PlayerName;
19 | }
20 | }
21 | }
--------------------------------------------------------------------------------
/Samples~/SamplesGuideInfo/Scripts/Readme.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Unity Technologies.
2 | // Based on the "URP TutorialInfo ReadmeEditor.cs" script included in URP template projects.
3 | //
4 | // Original asset by Unity Technologies. This version has been modified to display
5 | // a custom Readme.asset in the Inspector about how to use the Singletons package
6 | //
7 | // Modified by ThatAmuzak - 2025
8 |
9 | using System;
10 | using System.Collections.Generic;
11 | using UnityEngine;
12 |
13 | [CreateAssetMenu(fileName = "Readme", menuName = "ScriptableObjects/Readme", order = 1)]
14 | public class Readme : ScriptableObject
15 | {
16 | public string title;
17 | public Section[] sections;
18 |
19 | [Serializable]
20 | public class Section
21 | {
22 | public string heading;
23 | public List text;
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "com.unitycommunity.unitysingleton",
3 | "version": "3.0.0",
4 | "displayName": "Unity Singleton",
5 | "description": "The best way to implement singleton pattern in Unity. ",
6 | "unity": "2022.3",
7 | "author": {
8 | "name": "Unity Community",
9 | "email": "hasanbayat1393@gmail.com"
10 | },
11 | "scopedRegistries": [],
12 | "changelogUrl": "https://github.com/UnityCommunity/UnitySingleton/blob/main/CHANGELOG.md",
13 | "license": "MIT",
14 | "licensesUrl": "https://github.com/UnityCommunity/UnitySingleton/blob/main/LICENSE",
15 | "documentationUrl": "https://github.com/UnityCommunity/UnitySingleton/blob/main/README.md",
16 | "samples": [
17 | {
18 | "displayName": "Samples",
19 | "description": "Sample scene with Singleton Setup. Based on a _Preload workflow",
20 | "path": "Samples~/"
21 | }
22 | ]
23 | }
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) 2017 Unity Community
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Runtime/Scripts/PersistentMonoSingleton.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | namespace UnityCommunity.UnitySingleton
4 | {
5 | ///
6 | /// This singleton is persistent across scenes by calling .
7 | ///
8 | ///
9 | public abstract class PersistentMonoSingleton : MonoSingleton where T : MonoSingleton
10 | {
11 | ///
12 | /// if this is true, this singleton will auto detach if it finds itself parented on awake
13 | ///
14 | [Tooltip("if this is true, this singleton will auto detach if it finds itself parented on awake")]
15 | [SerializeField] private bool UnparentOnAwake = true;
16 |
17 | #region Protected Methods
18 |
19 | protected override void OnInitializing()
20 | {
21 | if (UnparentOnAwake) {
22 | transform.SetParent(null);
23 | }
24 | base.OnInitializing();
25 | if (Application.isPlaying)
26 | {
27 | DontDestroyOnLoad(gameObject);
28 | }
29 | }
30 |
31 | #endregion
32 | }
33 | }
--------------------------------------------------------------------------------
/CONTRIBUTING.md:
--------------------------------------------------------------------------------
1 | # Contributing to Unity Singleton
2 |
3 | Thank you for considering contributing to Unity Singleton! We welcome contributions from the community to help improve this project.
4 |
5 | ## How to Contribute
6 |
7 | 1. **Fork the Repository**: Start by forking the repository to your GitHub account.
8 |
9 | 2. **Clone the Repository**: Clone the forked repository to your local machine.
10 | ```sh
11 | git clone https://github.com/**your-username**/unitysingleton.git
12 | ```
13 |
14 | 3. **Create a Branch**: Create a new branch for your feature or bugfix.
15 | ```sh
16 | git checkout -b **feature-name**
17 | ```
18 |
19 | 4. **Make Changes**: Make your changes to the codebase.
20 |
21 | 5. **Commit Changes**: Commit your changes with a clear and descriptive commit message.
22 | ```sh
23 | git commit -m "Description of the feature or fix"
24 | ```
25 |
26 | 6. **Push Changes**: Push your changes to your forked repository.
27 | ```sh
28 | git push origin feature-name
29 | ```
30 |
31 | 7. **Create a Pull Request**: Open a pull request to the main repository. Provide a clear description of your changes and any related issues.
32 |
33 | ## Reporting Issues
34 |
35 | If you encounter any issues, please report them on the issues tab. Provide as much detail as possible to help us resolve the issue quickly.
36 |
37 | ## Getting Help
38 |
39 | If you need help or have any questions, feel free to reach out by opening an issue or joining our community discussions.
40 |
--------------------------------------------------------------------------------
/Samples~/Readme.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!114 &11400000
4 | MonoBehaviour:
5 | m_ObjectHideFlags: 0
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | m_GameObject: {fileID: 0}
10 | m_Enabled: 1
11 | m_EditorHideFlags: 0
12 | m_Script: {fileID: 11500000, guid: fcf7219bab7fe46a1ad266029b2fee19, type: 3}
13 | m_Name: Readme
14 | m_EditorClassIdentifier:
15 | title: How to use Unity Singleton
16 | sections:
17 | - heading: Example Usage
18 | text:
19 | - This is a quick demo on how to use the Unity Singleton Package
20 | - 'To quickly test it out:'
21 | - "\u2022 Go to the Scenes in this Samples folder"
22 | - "\u2022 Add the scenes in the following order"
23 | - " \u2022 _Preload"
24 | - " \u2022 Main Menu"
25 | - "\u2022 Then open the Scenes folder and edit the name parameter on the GameManager component attached to the GameManager object"
26 | - "\u2022 Save and press play"
27 | - "\u2022 The scene will change to the Main Menu, and the log will print out the name provided"
28 | - heading: Functionality overview
29 | text:
30 | - Add using UnityCommunity.UnitySingleton; for using the classes
31 | - "\u2022 Use Singleton for plain C# classes"
32 | - "\u2022 Use MonoSingleton if you want a Scene-based singleton which is not persistent across scenes"
33 | - "\u2022 Use PersistentMonoSingleton if you want a Global and persistent singleton across scenes"
34 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # This .gitignore file should be placed at the root of your Unity project directory
2 | #
3 | # Get latest from https://github.com/github/gitignore/blob/master/Unity.gitignore
4 | #
5 | /[Ll]ibrary/
6 | /[Tt]emp/
7 | /[Oo]bj/
8 | /[Bb]uild/
9 | /[Bb]uilds/
10 | /[Ll]ogs/
11 | /[Uu]ser[Ss]ettings/
12 |
13 | # MemoryCaptures can get excessive in size.
14 | # They also could contain extremely sensitive data
15 | /[Mm]emoryCaptures/
16 |
17 | # Asset meta data should only be ignored when the corresponding asset is also ignored
18 | !/[Aa]ssets/**/*.meta
19 |
20 | # Uncomment this line if you wish to ignore the asset store tools plugin
21 | # /[Aa]ssets/AssetStoreTools*
22 |
23 | # Autogenerated Jetbrains Rider plugin
24 | /[Aa]ssets/Plugins/Editor/JetBrains*
25 |
26 | # Visual Studio cache directory
27 | .vs/
28 |
29 | # Jetbrains Rider cache directory
30 | .idea/
31 |
32 | # Gradle cache directory
33 | .gradle/
34 |
35 | # Autogenerated VS/MD/Consulo solution and project files
36 | ExportedObj/
37 | .consulo/
38 | *.csproj
39 | *.unityproj
40 | *.sln
41 | *.suo
42 | *.tmp
43 | *.user
44 | *.userprefs
45 | *.pidb
46 | *.booproj
47 | *.svd
48 | *.pdb
49 | *.mdb
50 | *.opendb
51 | *.VC.db
52 |
53 | # Unity3D generated meta files
54 | *.pidb.meta
55 | *.pdb.meta
56 | *.mdb.meta
57 |
58 | # Unity3D generated file on crash reports
59 | sysinfo.txt
60 |
61 | # Builds
62 | *.apk
63 | *.aab
64 | *.unitypackage
65 |
66 | # Crashlytics generated file
67 | crashlytics-build.properties
68 |
69 | # Packed Addressables
70 | /[Aa]ssets/[Aa]ddressable[Aa]ssets[Dd]ata/*/*.bin*
71 |
72 | # Temporary auto-generated Android Assets
73 | /[Aa]ssets/[Ss]treamingAssets/aa.meta
74 | /[Aa]ssets/[Ss]treamingAssets/aa/*
75 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 |
2 | # Change Log
3 |
4 | All notable changes to this project will be documented in this file.
5 |
6 | The format is based on [Keep a Changelog](http://keepachangelog.com/)
7 | and this project adheres to [Semantic Versioning](http://semver.org/).
8 |
9 | ## [3.0.0] - 2025-02-20
10 |
11 | Full conversion of project to UPM Package
12 |
13 | ### Added
14 |
15 | - Change log
16 | - Included support for Unity 6 with backward compatibility
17 |
18 | ## Changed
19 |
20 | - Project structure for UPM package setup with instructions on installation
21 |
22 | ## Fixed
23 |
24 | - Unused Imports
25 |
26 | ## [2.0.1] - 2024-07-07
27 |
28 | ### Fixed
29 |
30 | - Instance caused a stack overflow
31 |
32 | ## [2.0.0] - 2024-01-23
33 |
34 | Major revision of the singletons implementation
35 |
36 | ### Added
37 |
38 | - Added `PersistentMonoSingleton` which is persistent across scenes
39 | - Added `ISingleton` interface for unifying the methods and calls
40 | - Added assembly definition
41 | - Added namespace (`UnityCommunity.UnitySingleton`)
42 |
43 | ### Changed
44 |
45 | - Made `MonoSingleton` non-persistent
46 |
47 | ## [1.2.1] - 2024-01-22
48 |
49 | ### Fixed
50 |
51 | - Added missing methods for `MonoSingleton`
52 |
53 | ## [1.2.0] - 2017-12-2
54 |
55 | ### Added
56 |
57 | - Init for existing instance and basic editor mode support
58 |
59 | ## [1.1.0] - 2023-11-27
60 |
61 | ### Added
62 |
63 | - Scene `Singleton` (or Local Singleton) for non-persistent singletons across scene changes
64 | - `MonoSingleton` to quickly extend `MonoBehaviour` as singletons
65 |
66 | ### Changed
67 |
68 | - Extended Generic `Singleton` class with additional virtual functions (earlier this was extending `MonoBehaviour`)
69 |
70 | ## [1.0.0] - 2017-09-16
71 |
72 | ### Added
73 |
74 | - Base files for the project with a generic `Singleton`
75 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | | [Getting Started](#getting-started) | [Features](#features) | [License](#license) | [Resources](#resources) | [Download](#download) |
2 | | ----------------------------------- | --------------------- | ------------------- | ----------------------- | --------------------- |
3 |
4 | # Unity Singleton
5 |
6 | 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.
7 |
8 | :book: [Learn More about Singleton pattern](https://en.wikipedia.org/wiki/Singleton_pattern)
9 |
10 | ## Features
11 |
12 | - Works in both Development and Production
13 | - Instantiates Singleton objects if they aren't available by Lazy Load
14 | - You can configure fields in the inspector for singleton objects in the preload scene
15 |
16 | ## Getting Started
17 |
18 | This package can be added to your project via [Git UPM](https://docs.unity3d.com/6000.0/Documentation/Manual/upm-ui-giturl.html).
19 | To add this package, copy:
20 |
21 | ```shell
22 | https://github.com/UnityCommunity/UnitySingleton.git
23 | ```
24 |
25 | and add it as a git package in the Unity Package Manager by clicking on the "+" icon on the top left of the Package Manager Window, and selecting "Install package from git URL".
26 |
27 | Once you have the package installed, you may
28 |
29 | - Create your own Singleton classes by extending the Generic [:sparkles: Singleton :sparkles:](Runtime/Scripts/Singleton.cs) class. (:rocket: Check out the example [GameManager](Samples~/Scripts/GameManager.cs) in the example [\_Preload scene](Samples~/Scenes/_Preload.unity).)
30 | - Attach your singleton classes to a GameManager game object in a \_Preload scene of your own.
31 | - Edit the variables inside the inspector
32 | - Run the game and enjoy!
33 |
34 | ## Usage
35 |
36 | Add `using UnityCommunity.UnitySingleton;` for using the classes.
37 |
38 | - Use `Singleton` for plain C# classes.
39 | - Use `MonoSingleton` if you want a Scene-based singleton which is not persistent across scenes.
40 | - Use `PersistentMonoSingleton` if you want a Global and persistent singleton across scenes.
41 |
42 | ## Contribute
43 |
44 | Please refer to [CONTRIBUTING.md](CONTRIBUTING.md) for more information on how to contribute to this project.
45 |
46 | ## Download
47 |
48 | Run the following command in terminal or command prompt to clone the repository:
49 |
50 | ```bash
51 | git clone https://github.com/UnityCommunity/UnitySingleton.git
52 | ```
53 |
54 | Or [:fire: Download the master branch as zip](https://github.com/UnityCommunity/UnitySingleton/archive/master.zip).
55 |
56 | ## Resources
57 |
58 | - [:book: Wikipedia](https://en.wikipedia.org/wiki/Singleton_pattern)
59 | - [:book: On the \_Preload Scene](https://stackoverflow.com/questions/35890932/unity-game-manager-script-works-only-one-time/35891919#35891919)
60 | - [:arrow_forward: Deep dive into the Singleton Pattern](https://www.youtube.com/watch?v=mpM0C6quQjs)
61 |
62 | ## License
63 |
64 | MIT @ [Unity Community](https://github.com/UnityCommunity)
65 |
66 | Made with :heart: by [Unity Community](https://github.com/UnityCommunity)
67 |
--------------------------------------------------------------------------------
/Runtime/Scripts/Singleton.cs:
--------------------------------------------------------------------------------
1 | namespace UnityCommunity.UnitySingleton
2 | {
3 | public enum SingletonInitializationStatus
4 | {
5 | None,
6 | Initializing,
7 | Initialized
8 | }
9 |
10 | ///
11 | /// The singleton implementation for classes.
12 | ///
13 | ///
14 | public abstract class Singleton : ISingleton where T : Singleton, new()
15 | {
16 |
17 | #region Fields
18 |
19 | ///
20 | /// The instance.
21 | ///
22 | private static T instance;
23 |
24 | ///
25 | /// The initialization status of the singleton's instance.
26 | ///
27 | private SingletonInitializationStatus initializationStatus = SingletonInitializationStatus.None;
28 |
29 | #endregion
30 |
31 | #region Properties
32 |
33 | ///
34 | /// Gets the instance.
35 | ///
36 | /// The instance.
37 | public static T Instance
38 | {
39 | get
40 | {
41 | if (instance == null)
42 | {
43 | //ensure that only one thread can execute
44 | lock (typeof(T))
45 | {
46 | if (instance == null)
47 | {
48 | instance = new T();
49 | instance.InitializeSingleton();
50 | }
51 | }
52 | }
53 |
54 | return instance;
55 | }
56 | }
57 |
58 | ///
59 | /// Gets whether the singleton's instance is initialized.
60 | ///
61 | public virtual bool IsInitialized => this.initializationStatus == SingletonInitializationStatus.Initialized;
62 |
63 | #endregion
64 |
65 | #region Protected Methods
66 |
67 | protected virtual void OnInitializing()
68 | {
69 |
70 | }
71 |
72 | protected virtual void OnInitialized()
73 | {
74 |
75 | }
76 |
77 | #endregion
78 |
79 | #region Public Methods
80 |
81 | public virtual void InitializeSingleton()
82 | {
83 | if (this.initializationStatus != SingletonInitializationStatus.None)
84 | {
85 | return;
86 | }
87 |
88 | this.initializationStatus = SingletonInitializationStatus.Initializing;
89 | OnInitializing();
90 | this.initializationStatus = SingletonInitializationStatus.Initialized;
91 | OnInitialized();
92 | }
93 |
94 | public virtual void ClearSingleton() { }
95 |
96 | public static void CreateInstance()
97 | {
98 | DestroyInstance();
99 | instance = Instance;
100 | }
101 |
102 | public static void DestroyInstance()
103 | {
104 | if (instance == null)
105 | {
106 | return;
107 | }
108 |
109 | instance.ClearSingleton();
110 | instance = default(T);
111 | }
112 |
113 | #endregion
114 |
115 | }
116 |
117 | }
--------------------------------------------------------------------------------
/Runtime/Scripts/MonoSingleton.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | namespace UnityCommunity.UnitySingleton
4 | {
5 | ///
6 | /// The basic MonoBehaviour singleton implementation, this singleton is destroyed after scene changes, use if you want a persistent and global singleton instance.
7 | ///
8 | ///
9 | [DefaultExecutionOrder(-50)]
10 | public abstract class MonoSingleton : MonoBehaviour, ISingleton where T : MonoSingleton
11 | {
12 | #region Fields
13 |
14 | ///
15 | /// The instance.
16 | ///
17 | private static T instance;
18 |
19 | ///
20 | /// The initialization status of the singleton's instance.
21 | ///
22 | private SingletonInitializationStatus initializationStatus = SingletonInitializationStatus.None;
23 |
24 | #endregion
25 |
26 | #region Properties
27 |
28 | ///
29 | /// Gets the instance.
30 | ///
31 | /// The instance.
32 | public static T Instance
33 | {
34 | get
35 | {
36 | if (instance == null)
37 | {
38 | #if UNITY_6000
39 | instance = FindAnyObjectByType();
40 | #else
41 | instance = FindObjectOfType();
42 | #endif
43 | if (instance == null)
44 | {
45 | GameObject obj = new GameObject();
46 | obj.name = typeof(T).Name;
47 | instance = obj.AddComponent();
48 | instance.OnMonoSingletonCreated();
49 | }
50 | }
51 | return instance;
52 | }
53 | }
54 |
55 | ///
56 | /// Gets whether the singleton's instance is initialized.
57 | ///
58 | public virtual bool IsInitialized => this.initializationStatus == SingletonInitializationStatus.Initialized;
59 |
60 | #endregion
61 |
62 | #region Unity Messages
63 |
64 | ///
65 | /// Use this for initialization.
66 | ///
67 | protected virtual void Awake()
68 | {
69 | if (instance == null)
70 | {
71 | instance = this as T;
72 |
73 | // Initialize existing instance
74 | InitializeSingleton();
75 | }
76 | else if (instance != this)
77 | {
78 |
79 | // Destory duplicates
80 | if (Application.isPlaying)
81 | {
82 | Destroy(gameObject);
83 | }
84 | else
85 | {
86 | DestroyImmediate(gameObject);
87 | }
88 | }
89 | }
90 |
91 | #endregion
92 |
93 | #region Protected Methods
94 |
95 | ///
96 | /// This gets called once the singleton's instance is created.
97 | ///
98 | protected virtual void OnMonoSingletonCreated()
99 | {
100 |
101 | }
102 |
103 | protected virtual void OnInitializing()
104 | {
105 |
106 | }
107 |
108 | protected virtual void OnInitialized()
109 | {
110 |
111 | }
112 |
113 | #endregion
114 |
115 | #region Public Methods
116 |
117 | public virtual void InitializeSingleton()
118 | {
119 | if (this.initializationStatus != SingletonInitializationStatus.None)
120 | {
121 | return;
122 | }
123 |
124 | this.initializationStatus = SingletonInitializationStatus.Initializing;
125 | OnInitializing();
126 | this.initializationStatus = SingletonInitializationStatus.Initialized;
127 | OnInitialized();
128 | }
129 |
130 | public virtual void ClearSingleton() { }
131 |
132 | public static void CreateInstance()
133 | {
134 | DestroyInstance();
135 | instance = Instance;
136 | }
137 |
138 | public static void DestroyInstance()
139 | {
140 | if (instance == null)
141 | {
142 | return;
143 | }
144 |
145 | instance.ClearSingleton();
146 | instance = default(T);
147 | }
148 |
149 | #endregion
150 | }
151 | }
152 |
--------------------------------------------------------------------------------
/Samples~/Scenes/_Preload.unity:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!29 &1
4 | OcclusionCullingSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_OcclusionBakeSettings:
8 | smallestOccluder: 5
9 | smallestHole: 0.25
10 | backfaceThreshold: 100
11 | m_SceneGUID: 00000000000000000000000000000000
12 | m_OcclusionCullingData: {fileID: 0}
13 | --- !u!104 &2
14 | RenderSettings:
15 | m_ObjectHideFlags: 0
16 | serializedVersion: 10
17 | m_Fog: 0
18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
19 | m_FogMode: 3
20 | m_FogDensity: 0.01
21 | m_LinearFogStart: 0
22 | m_LinearFogEnd: 300
23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
26 | m_AmbientIntensity: 1
27 | m_AmbientMode: 0
28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
30 | m_HaloStrength: 0.5
31 | m_FlareStrength: 1
32 | m_FlareFadeSpeed: 3
33 | m_HaloTexture: {fileID: 0}
34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
35 | m_DefaultReflectionMode: 0
36 | m_DefaultReflectionResolution: 128
37 | m_ReflectionBounces: 1
38 | m_ReflectionIntensity: 1
39 | m_CustomReflection: {fileID: 0}
40 | m_Sun: {fileID: 0}
41 | m_UseRadianceAmbientProbe: 0
42 | --- !u!157 &3
43 | LightmapSettings:
44 | m_ObjectHideFlags: 0
45 | serializedVersion: 13
46 | m_BakeOnSceneLoad: 0
47 | m_GISettings:
48 | serializedVersion: 2
49 | m_BounceScale: 1
50 | m_IndirectOutputScale: 1
51 | m_AlbedoBoost: 1
52 | m_EnvironmentLightingMode: 0
53 | m_EnableBakedLightmaps: 1
54 | m_EnableRealtimeLightmaps: 0
55 | m_LightmapEditorSettings:
56 | serializedVersion: 12
57 | m_Resolution: 2
58 | m_BakeResolution: 40
59 | m_AtlasSize: 1024
60 | m_AO: 0
61 | m_AOMaxDistance: 1
62 | m_CompAOExponent: 1
63 | m_CompAOExponentDirect: 0
64 | m_ExtractAmbientOcclusion: 0
65 | m_Padding: 2
66 | m_LightmapParameters: {fileID: 0}
67 | m_LightmapsBakeMode: 1
68 | m_TextureCompression: 1
69 | m_ReflectionCompression: 2
70 | m_MixedBakeMode: 2
71 | m_BakeBackend: 1
72 | m_PVRSampling: 1
73 | m_PVRDirectSampleCount: 32
74 | m_PVRSampleCount: 512
75 | m_PVRBounces: 2
76 | m_PVREnvironmentSampleCount: 256
77 | m_PVREnvironmentReferencePointCount: 2048
78 | m_PVRFilteringMode: 1
79 | m_PVRDenoiserTypeDirect: 1
80 | m_PVRDenoiserTypeIndirect: 1
81 | m_PVRDenoiserTypeAO: 1
82 | m_PVRFilterTypeDirect: 0
83 | m_PVRFilterTypeIndirect: 0
84 | m_PVRFilterTypeAO: 0
85 | m_PVREnvironmentMIS: 1
86 | m_PVRCulling: 1
87 | m_PVRFilteringGaussRadiusDirect: 1
88 | m_PVRFilteringGaussRadiusIndirect: 1
89 | m_PVRFilteringGaussRadiusAO: 1
90 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5
91 | m_PVRFilteringAtrousPositionSigmaIndirect: 2
92 | m_PVRFilteringAtrousPositionSigmaAO: 1
93 | m_ExportTrainingData: 0
94 | m_TrainingDataDestination: TrainingData
95 | m_LightProbeSampleCountMultiplier: 4
96 | m_LightingDataAsset: {fileID: 20201, guid: 0000000000000000f000000000000000, type: 0}
97 | m_LightingSettings: {fileID: 0}
98 | --- !u!196 &4
99 | NavMeshSettings:
100 | serializedVersion: 2
101 | m_ObjectHideFlags: 0
102 | m_BuildSettings:
103 | serializedVersion: 3
104 | agentTypeID: 0
105 | agentRadius: 0.5
106 | agentHeight: 2
107 | agentSlope: 45
108 | agentClimb: 0.4
109 | ledgeDropHeight: 0
110 | maxJumpAcrossDistance: 0
111 | minRegionArea: 2
112 | manualCellSize: 0
113 | cellSize: 0.16666667
114 | manualTileSize: 0
115 | tileSize: 256
116 | buildHeightMesh: 0
117 | maxJobWorkers: 0
118 | preserveTilesOutsideBounds: 0
119 | debug:
120 | m_Flags: 0
121 | m_NavMeshData: {fileID: 0}
122 | --- !u!1 &203562652
123 | GameObject:
124 | m_ObjectHideFlags: 0
125 | m_CorrespondingSourceObject: {fileID: 0}
126 | m_PrefabInstance: {fileID: 0}
127 | m_PrefabAsset: {fileID: 0}
128 | serializedVersion: 6
129 | m_Component:
130 | - component: {fileID: 203562653}
131 | - component: {fileID: 203562654}
132 | m_Layer: 0
133 | m_Name: GameManager
134 | m_TagString: Untagged
135 | m_Icon: {fileID: 0}
136 | m_NavMeshLayer: 0
137 | m_StaticEditorFlags: 0
138 | m_IsActive: 1
139 | --- !u!4 &203562653
140 | Transform:
141 | m_ObjectHideFlags: 0
142 | m_CorrespondingSourceObject: {fileID: 0}
143 | m_PrefabInstance: {fileID: 0}
144 | m_PrefabAsset: {fileID: 0}
145 | m_GameObject: {fileID: 203562652}
146 | serializedVersion: 2
147 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
148 | m_LocalPosition: {x: 0, y: 0, z: 0}
149 | m_LocalScale: {x: 1, y: 1, z: 1}
150 | m_ConstrainProportionsScale: 0
151 | m_Children: []
152 | m_Father: {fileID: 0}
153 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
154 | --- !u!114 &203562654
155 | MonoBehaviour:
156 | m_ObjectHideFlags: 0
157 | m_CorrespondingSourceObject: {fileID: 0}
158 | m_PrefabInstance: {fileID: 0}
159 | m_PrefabAsset: {fileID: 0}
160 | m_GameObject: {fileID: 203562652}
161 | m_Enabled: 1
162 | m_EditorHideFlags: 0
163 | m_Script: {fileID: 11500000, guid: d4c34455da4a426fb79fdb00cf3f99b1, type: 3}
164 | m_Name:
165 | m_EditorClassIdentifier:
166 | m_PlayerName: Hasan Bayat
167 | --- !u!1660057539 &9223372036854775807
168 | SceneRoots:
169 | m_ObjectHideFlags: 0
170 | m_Roots:
171 | - {fileID: 203562653}
172 |
--------------------------------------------------------------------------------
/Samples~/SamplesGuideInfo/Scripts/Editor/ReadmeEditor.cs:
--------------------------------------------------------------------------------
1 | // Copyright (c) Unity Technologies.
2 | // Based on the "URP TutorialInfo ReadmeEditor.cs" script included in URP template projects.
3 | //
4 | // Original asset by Unity Technologies. This version has been modified to display
5 | // a custom Readme.asset in the Inspector about how to use the Singletons package
6 | //
7 | // Modified by github.com/ThatAmuzak - 2025
8 |
9 | using UnityEngine;
10 | using UnityEditor;
11 | using System.IO;
12 |
13 | [CustomEditor(typeof(Readme))]
14 | public class ReadmeEditor : Editor
15 | {
16 | const float k_Space = 8f;
17 |
18 | static void RemoveTutorial()
19 | {
20 | string s_ReadmeSourcePath = GetReadmePath();
21 | if (string.IsNullOrEmpty(s_ReadmeSourcePath))
22 | {
23 | Debug.LogWarning("Could not determine the Readme folder path.");
24 | return;
25 | }
26 |
27 | string s_ReadmeSourceDirectory = Path.GetDirectoryName(s_ReadmeSourcePath) + "\\SamplesGuideInfo";
28 |
29 | if (EditorUtility.DisplayDialog("Remove Readme Assets", $"All contents under {s_ReadmeSourceDirectory} will be removed, are you sure you want to proceed?", "Proceed", "Cancel"))
30 | {
31 | if (Directory.Exists(s_ReadmeSourceDirectory))
32 | {
33 | FileUtil.DeleteFileOrDirectory(s_ReadmeSourceDirectory);
34 | FileUtil.DeleteFileOrDirectory(s_ReadmeSourceDirectory + ".meta");
35 | }
36 | else
37 | {
38 | Debug.Log($"Could not find the Readme folder at {s_ReadmeSourceDirectory}");
39 | }
40 |
41 | var readmeAsset = SelectReadme();
42 | if (readmeAsset != null)
43 | {
44 | var path = AssetDatabase.GetAssetPath(readmeAsset);
45 | FileUtil.DeleteFileOrDirectory(path + ".meta");
46 | FileUtil.DeleteFileOrDirectory(path);
47 | }
48 |
49 | AssetDatabase.Refresh();
50 | }
51 | }
52 |
53 | static string GetReadmePath()
54 | {
55 | var readmeAsset = Selection.activeObject;
56 | if (readmeAsset == null) return string.Empty;
57 |
58 | string path = AssetDatabase.GetAssetPath(readmeAsset);
59 | return path;
60 | }
61 |
62 | static Readme SelectReadme()
63 | {
64 | var ids = AssetDatabase.FindAssets("Readme t:Readme");
65 | if (ids.Length == 1)
66 | {
67 | var readmeObject = AssetDatabase.LoadMainAssetAtPath(AssetDatabase.GUIDToAssetPath(ids[0]));
68 |
69 | Selection.objects = new[] { readmeObject };
70 |
71 | return (Readme)readmeObject;
72 | }
73 |
74 | Debug.Log("Couldn't find a readme");
75 | return null;
76 | }
77 |
78 | protected override void OnHeaderGUI()
79 | {
80 | var readme = (Readme)target;
81 | Init();
82 |
83 | GUILayout.BeginHorizontal("In BigTitle");
84 | {
85 | GUILayout.Space(k_Space);
86 | GUILayout.BeginVertical();
87 | {
88 |
89 | GUILayout.FlexibleSpace();
90 | GUILayout.Label(readme.title, TitleStyle);
91 | GUILayout.FlexibleSpace();
92 | }
93 | GUILayout.EndVertical();
94 | GUILayout.FlexibleSpace();
95 | }
96 | GUILayout.EndHorizontal();
97 | }
98 |
99 | public override void OnInspectorGUI()
100 | {
101 | var readme = (Readme)target;
102 | Init();
103 | Rect rect;
104 | foreach (var section in readme.sections)
105 | {
106 | GUILayout.Space(k_Space);
107 | rect = EditorGUILayout.GetControlRect(false, 2 );
108 | rect.height = 2;
109 | EditorGUI.DrawRect(rect, new Color ( 0.5f,0.5f,0.5f, 1 ) );
110 | GUILayout.Space(k_Space);
111 |
112 | if (!string.IsNullOrEmpty(section.heading))
113 | {
114 | GUILayout.Label(section.heading, HeadingStyle);
115 | }
116 |
117 | foreach (var subtext in section.text)
118 | {
119 | if (!string.IsNullOrEmpty(subtext))
120 | {
121 | GUILayout.Label(subtext, BodyStyle);
122 | }
123 | }
124 | }
125 | GUILayout.Space(k_Space);
126 | rect = EditorGUILayout.GetControlRect(false, 2 );
127 | rect.height = 2;
128 | GUILayout.Space(k_Space);
129 | if (GUILayout.Button("Remove Readme Assets", ButtonStyle))
130 | {
131 | RemoveTutorial();
132 | }
133 | }
134 |
135 | bool m_Initialized;
136 |
137 | GUIStyle TitleStyle => m_TitleStyle;
138 |
139 | [SerializeField]
140 | GUIStyle m_TitleStyle;
141 |
142 | GUIStyle HeadingStyle => m_HeadingStyle;
143 |
144 | [SerializeField]
145 | GUIStyle m_HeadingStyle;
146 |
147 | GUIStyle BodyStyle => m_BodyStyle;
148 |
149 | [SerializeField]
150 | GUIStyle m_BodyStyle;
151 |
152 | GUIStyle ButtonStyle => m_ButtonStyle;
153 |
154 | [SerializeField]
155 | GUIStyle m_ButtonStyle;
156 |
157 | void Init()
158 | {
159 | if (m_Initialized)
160 | return;
161 | m_BodyStyle = new GUIStyle(EditorStyles.label);
162 | m_BodyStyle.wordWrap = true;
163 | m_BodyStyle.fontSize = 14;
164 | m_BodyStyle.richText = true;
165 |
166 | m_TitleStyle = new GUIStyle(m_BodyStyle);
167 | m_TitleStyle.fontSize = 26;
168 |
169 | m_HeadingStyle = new GUIStyle(m_BodyStyle);
170 | m_HeadingStyle.fontStyle = FontStyle.Bold;
171 | m_HeadingStyle.fontSize = 18;
172 |
173 | m_ButtonStyle = new GUIStyle(EditorStyles.miniButton);
174 | m_ButtonStyle.fontStyle = FontStyle.Bold;
175 |
176 | m_Initialized = true;
177 | }
178 | }
179 |
--------------------------------------------------------------------------------
/Samples~/Scenes/Game.unity:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!29 &1
4 | OcclusionCullingSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_OcclusionBakeSettings:
8 | smallestOccluder: 5
9 | smallestHole: 0.25
10 | backfaceThreshold: 100
11 | m_SceneGUID: 00000000000000000000000000000000
12 | m_OcclusionCullingData: {fileID: 0}
13 | --- !u!104 &2
14 | RenderSettings:
15 | m_ObjectHideFlags: 0
16 | serializedVersion: 10
17 | m_Fog: 0
18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
19 | m_FogMode: 3
20 | m_FogDensity: 0.01
21 | m_LinearFogStart: 0
22 | m_LinearFogEnd: 300
23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
26 | m_AmbientIntensity: 1
27 | m_AmbientMode: 0
28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
30 | m_HaloStrength: 0.5
31 | m_FlareStrength: 1
32 | m_FlareFadeSpeed: 3
33 | m_HaloTexture: {fileID: 0}
34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
35 | m_DefaultReflectionMode: 0
36 | m_DefaultReflectionResolution: 128
37 | m_ReflectionBounces: 1
38 | m_ReflectionIntensity: 1
39 | m_CustomReflection: {fileID: 0}
40 | m_Sun: {fileID: 0}
41 | m_UseRadianceAmbientProbe: 0
42 | --- !u!157 &3
43 | LightmapSettings:
44 | m_ObjectHideFlags: 0
45 | serializedVersion: 13
46 | m_BakeOnSceneLoad: 0
47 | m_GISettings:
48 | serializedVersion: 2
49 | m_BounceScale: 1
50 | m_IndirectOutputScale: 1
51 | m_AlbedoBoost: 1
52 | m_EnvironmentLightingMode: 0
53 | m_EnableBakedLightmaps: 1
54 | m_EnableRealtimeLightmaps: 0
55 | m_LightmapEditorSettings:
56 | serializedVersion: 12
57 | m_Resolution: 2
58 | m_BakeResolution: 40
59 | m_AtlasSize: 1024
60 | m_AO: 0
61 | m_AOMaxDistance: 1
62 | m_CompAOExponent: 1
63 | m_CompAOExponentDirect: 0
64 | m_ExtractAmbientOcclusion: 0
65 | m_Padding: 2
66 | m_LightmapParameters: {fileID: 0}
67 | m_LightmapsBakeMode: 1
68 | m_TextureCompression: 1
69 | m_ReflectionCompression: 2
70 | m_MixedBakeMode: 2
71 | m_BakeBackend: 1
72 | m_PVRSampling: 1
73 | m_PVRDirectSampleCount: 32
74 | m_PVRSampleCount: 512
75 | m_PVRBounces: 2
76 | m_PVREnvironmentSampleCount: 256
77 | m_PVREnvironmentReferencePointCount: 2048
78 | m_PVRFilteringMode: 1
79 | m_PVRDenoiserTypeDirect: 1
80 | m_PVRDenoiserTypeIndirect: 1
81 | m_PVRDenoiserTypeAO: 1
82 | m_PVRFilterTypeDirect: 0
83 | m_PVRFilterTypeIndirect: 0
84 | m_PVRFilterTypeAO: 0
85 | m_PVREnvironmentMIS: 1
86 | m_PVRCulling: 1
87 | m_PVRFilteringGaussRadiusDirect: 1
88 | m_PVRFilteringGaussRadiusIndirect: 1
89 | m_PVRFilteringGaussRadiusAO: 1
90 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5
91 | m_PVRFilteringAtrousPositionSigmaIndirect: 2
92 | m_PVRFilteringAtrousPositionSigmaAO: 1
93 | m_ExportTrainingData: 0
94 | m_TrainingDataDestination: TrainingData
95 | m_LightProbeSampleCountMultiplier: 4
96 | m_LightingDataAsset: {fileID: 20201, guid: 0000000000000000f000000000000000, type: 0}
97 | m_LightingSettings: {fileID: 0}
98 | --- !u!196 &4
99 | NavMeshSettings:
100 | serializedVersion: 2
101 | m_ObjectHideFlags: 0
102 | m_BuildSettings:
103 | serializedVersion: 3
104 | agentTypeID: 0
105 | agentRadius: 0.5
106 | agentHeight: 2
107 | agentSlope: 45
108 | agentClimb: 0.4
109 | ledgeDropHeight: 0
110 | maxJumpAcrossDistance: 0
111 | minRegionArea: 2
112 | manualCellSize: 0
113 | cellSize: 0.16666667
114 | manualTileSize: 0
115 | tileSize: 256
116 | buildHeightMesh: 0
117 | maxJobWorkers: 0
118 | preserveTilesOutsideBounds: 0
119 | debug:
120 | m_Flags: 0
121 | m_NavMeshData: {fileID: 0}
122 | --- !u!1 &816866412
123 | GameObject:
124 | m_ObjectHideFlags: 0
125 | m_CorrespondingSourceObject: {fileID: 0}
126 | m_PrefabInstance: {fileID: 0}
127 | m_PrefabAsset: {fileID: 0}
128 | serializedVersion: 6
129 | m_Component:
130 | - component: {fileID: 816866414}
131 | - component: {fileID: 816866413}
132 | m_Layer: 0
133 | m_Name: Directional Light
134 | m_TagString: Untagged
135 | m_Icon: {fileID: 0}
136 | m_NavMeshLayer: 0
137 | m_StaticEditorFlags: 0
138 | m_IsActive: 1
139 | --- !u!108 &816866413
140 | Light:
141 | m_ObjectHideFlags: 0
142 | m_CorrespondingSourceObject: {fileID: 0}
143 | m_PrefabInstance: {fileID: 0}
144 | m_PrefabAsset: {fileID: 0}
145 | m_GameObject: {fileID: 816866412}
146 | m_Enabled: 1
147 | serializedVersion: 11
148 | m_Type: 1
149 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
150 | m_Intensity: 1
151 | m_Range: 10
152 | m_SpotAngle: 30
153 | m_InnerSpotAngle: 21.80208
154 | m_CookieSize: 10
155 | m_Shadows:
156 | m_Type: 2
157 | m_Resolution: -1
158 | m_CustomResolution: -1
159 | m_Strength: 1
160 | m_Bias: 0.05
161 | m_NormalBias: 0.4
162 | m_NearPlane: 0.2
163 | m_CullingMatrixOverride:
164 | e00: 1
165 | e01: 0
166 | e02: 0
167 | e03: 0
168 | e10: 0
169 | e11: 1
170 | e12: 0
171 | e13: 0
172 | e20: 0
173 | e21: 0
174 | e22: 1
175 | e23: 0
176 | e30: 0
177 | e31: 0
178 | e32: 0
179 | e33: 1
180 | m_UseCullingMatrixOverride: 0
181 | m_Cookie: {fileID: 0}
182 | m_DrawHalo: 0
183 | m_Flare: {fileID: 0}
184 | m_RenderMode: 0
185 | m_CullingMask:
186 | serializedVersion: 2
187 | m_Bits: 4294967295
188 | m_RenderingLayerMask: 1
189 | m_Lightmapping: 4
190 | m_LightShadowCasterMode: 0
191 | m_AreaSize: {x: 1, y: 1}
192 | m_BounceIntensity: 1
193 | m_ColorTemperature: 6570
194 | m_UseColorTemperature: 0
195 | m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
196 | m_UseBoundingSphereOverride: 0
197 | m_UseViewFrustumForShadowCasterCull: 1
198 | m_ForceVisible: 0
199 | m_ShadowRadius: 0
200 | m_ShadowAngle: 0
201 | m_LightUnit: 1
202 | m_LuxAtDistance: 1
203 | m_EnableSpotReflector: 1
204 | --- !u!4 &816866414
205 | Transform:
206 | m_ObjectHideFlags: 0
207 | m_CorrespondingSourceObject: {fileID: 0}
208 | m_PrefabInstance: {fileID: 0}
209 | m_PrefabAsset: {fileID: 0}
210 | m_GameObject: {fileID: 816866412}
211 | serializedVersion: 2
212 | m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
213 | m_LocalPosition: {x: 0, y: 3, z: 0}
214 | m_LocalScale: {x: 1, y: 1, z: 1}
215 | m_ConstrainProportionsScale: 0
216 | m_Children: []
217 | m_Father: {fileID: 0}
218 | m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
219 | --- !u!1 &1379872856
220 | GameObject:
221 | m_ObjectHideFlags: 0
222 | m_CorrespondingSourceObject: {fileID: 0}
223 | m_PrefabInstance: {fileID: 0}
224 | m_PrefabAsset: {fileID: 0}
225 | serializedVersion: 6
226 | m_Component:
227 | - component: {fileID: 1379872859}
228 | - component: {fileID: 1379872858}
229 | - component: {fileID: 1379872857}
230 | m_Layer: 0
231 | m_Name: Main Camera
232 | m_TagString: MainCamera
233 | m_Icon: {fileID: 0}
234 | m_NavMeshLayer: 0
235 | m_StaticEditorFlags: 0
236 | m_IsActive: 1
237 | --- !u!81 &1379872857
238 | AudioListener:
239 | m_ObjectHideFlags: 0
240 | m_CorrespondingSourceObject: {fileID: 0}
241 | m_PrefabInstance: {fileID: 0}
242 | m_PrefabAsset: {fileID: 0}
243 | m_GameObject: {fileID: 1379872856}
244 | m_Enabled: 1
245 | --- !u!20 &1379872858
246 | Camera:
247 | m_ObjectHideFlags: 0
248 | m_CorrespondingSourceObject: {fileID: 0}
249 | m_PrefabInstance: {fileID: 0}
250 | m_PrefabAsset: {fileID: 0}
251 | m_GameObject: {fileID: 1379872856}
252 | m_Enabled: 1
253 | serializedVersion: 2
254 | m_ClearFlags: 1
255 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
256 | m_projectionMatrixMode: 1
257 | m_GateFitMode: 2
258 | m_FOVAxisMode: 0
259 | m_Iso: 200
260 | m_ShutterSpeed: 0.005
261 | m_Aperture: 16
262 | m_FocusDistance: 10
263 | m_FocalLength: 50
264 | m_BladeCount: 5
265 | m_Curvature: {x: 2, y: 11}
266 | m_BarrelClipping: 0.25
267 | m_Anamorphism: 0
268 | m_SensorSize: {x: 36, y: 24}
269 | m_LensShift: {x: 0, y: 0}
270 | m_NormalizedViewPortRect:
271 | serializedVersion: 2
272 | x: 0
273 | y: 0
274 | width: 1
275 | height: 1
276 | near clip plane: 0.3
277 | far clip plane: 1000
278 | field of view: 60
279 | orthographic: 0
280 | orthographic size: 5
281 | m_Depth: -1
282 | m_CullingMask:
283 | serializedVersion: 2
284 | m_Bits: 4294967295
285 | m_RenderingPath: -1
286 | m_TargetTexture: {fileID: 0}
287 | m_TargetDisplay: 0
288 | m_TargetEye: 3
289 | m_HDR: 1
290 | m_AllowMSAA: 1
291 | m_AllowDynamicResolution: 0
292 | m_ForceIntoRT: 0
293 | m_OcclusionCulling: 1
294 | m_StereoConvergence: 10
295 | m_StereoSeparation: 0.022
296 | --- !u!4 &1379872859
297 | Transform:
298 | m_ObjectHideFlags: 0
299 | m_CorrespondingSourceObject: {fileID: 0}
300 | m_PrefabInstance: {fileID: 0}
301 | m_PrefabAsset: {fileID: 0}
302 | m_GameObject: {fileID: 1379872856}
303 | serializedVersion: 2
304 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
305 | m_LocalPosition: {x: 0, y: 1, z: -10}
306 | m_LocalScale: {x: 1, y: 1, z: 1}
307 | m_ConstrainProportionsScale: 0
308 | m_Children: []
309 | m_Father: {fileID: 0}
310 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
311 | --- !u!1660057539 &9223372036854775807
312 | SceneRoots:
313 | m_ObjectHideFlags: 0
314 | m_Roots:
315 | - {fileID: 1379872859}
316 | - {fileID: 816866414}
317 |
--------------------------------------------------------------------------------
/Samples~/Scenes/Main Menu.unity:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!29 &1
4 | OcclusionCullingSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_OcclusionBakeSettings:
8 | smallestOccluder: 5
9 | smallestHole: 0.25
10 | backfaceThreshold: 100
11 | m_SceneGUID: 00000000000000000000000000000000
12 | m_OcclusionCullingData: {fileID: 0}
13 | --- !u!104 &2
14 | RenderSettings:
15 | m_ObjectHideFlags: 0
16 | serializedVersion: 10
17 | m_Fog: 0
18 | m_FogColor: {r: 0.5, g: 0.5, b: 0.5, a: 1}
19 | m_FogMode: 3
20 | m_FogDensity: 0.01
21 | m_LinearFogStart: 0
22 | m_LinearFogEnd: 300
23 | m_AmbientSkyColor: {r: 0.212, g: 0.227, b: 0.259, a: 1}
24 | m_AmbientEquatorColor: {r: 0.114, g: 0.125, b: 0.133, a: 1}
25 | m_AmbientGroundColor: {r: 0.047, g: 0.043, b: 0.035, a: 1}
26 | m_AmbientIntensity: 1
27 | m_AmbientMode: 0
28 | m_SubtractiveShadowColor: {r: 0.42, g: 0.478, b: 0.627, a: 1}
29 | m_SkyboxMaterial: {fileID: 10304, guid: 0000000000000000f000000000000000, type: 0}
30 | m_HaloStrength: 0.5
31 | m_FlareStrength: 1
32 | m_FlareFadeSpeed: 3
33 | m_HaloTexture: {fileID: 0}
34 | m_SpotCookie: {fileID: 10001, guid: 0000000000000000e000000000000000, type: 0}
35 | m_DefaultReflectionMode: 0
36 | m_DefaultReflectionResolution: 128
37 | m_ReflectionBounces: 1
38 | m_ReflectionIntensity: 1
39 | m_CustomReflection: {fileID: 0}
40 | m_Sun: {fileID: 0}
41 | m_UseRadianceAmbientProbe: 0
42 | --- !u!157 &3
43 | LightmapSettings:
44 | m_ObjectHideFlags: 0
45 | serializedVersion: 13
46 | m_BakeOnSceneLoad: 0
47 | m_GISettings:
48 | serializedVersion: 2
49 | m_BounceScale: 1
50 | m_IndirectOutputScale: 1
51 | m_AlbedoBoost: 1
52 | m_EnvironmentLightingMode: 0
53 | m_EnableBakedLightmaps: 1
54 | m_EnableRealtimeLightmaps: 0
55 | m_LightmapEditorSettings:
56 | serializedVersion: 12
57 | m_Resolution: 2
58 | m_BakeResolution: 40
59 | m_AtlasSize: 1024
60 | m_AO: 0
61 | m_AOMaxDistance: 1
62 | m_CompAOExponent: 1
63 | m_CompAOExponentDirect: 0
64 | m_ExtractAmbientOcclusion: 0
65 | m_Padding: 2
66 | m_LightmapParameters: {fileID: 0}
67 | m_LightmapsBakeMode: 1
68 | m_TextureCompression: 1
69 | m_ReflectionCompression: 2
70 | m_MixedBakeMode: 2
71 | m_BakeBackend: 1
72 | m_PVRSampling: 1
73 | m_PVRDirectSampleCount: 32
74 | m_PVRSampleCount: 512
75 | m_PVRBounces: 2
76 | m_PVREnvironmentSampleCount: 256
77 | m_PVREnvironmentReferencePointCount: 2048
78 | m_PVRFilteringMode: 1
79 | m_PVRDenoiserTypeDirect: 1
80 | m_PVRDenoiserTypeIndirect: 1
81 | m_PVRDenoiserTypeAO: 1
82 | m_PVRFilterTypeDirect: 0
83 | m_PVRFilterTypeIndirect: 0
84 | m_PVRFilterTypeAO: 0
85 | m_PVREnvironmentMIS: 1
86 | m_PVRCulling: 1
87 | m_PVRFilteringGaussRadiusDirect: 1
88 | m_PVRFilteringGaussRadiusIndirect: 1
89 | m_PVRFilteringGaussRadiusAO: 1
90 | m_PVRFilteringAtrousPositionSigmaDirect: 0.5
91 | m_PVRFilteringAtrousPositionSigmaIndirect: 2
92 | m_PVRFilteringAtrousPositionSigmaAO: 1
93 | m_ExportTrainingData: 0
94 | m_TrainingDataDestination: TrainingData
95 | m_LightProbeSampleCountMultiplier: 4
96 | m_LightingDataAsset: {fileID: 20201, guid: 0000000000000000f000000000000000, type: 0}
97 | m_LightingSettings: {fileID: 0}
98 | --- !u!196 &4
99 | NavMeshSettings:
100 | serializedVersion: 2
101 | m_ObjectHideFlags: 0
102 | m_BuildSettings:
103 | serializedVersion: 3
104 | agentTypeID: 0
105 | agentRadius: 0.5
106 | agentHeight: 2
107 | agentSlope: 45
108 | agentClimb: 0.4
109 | ledgeDropHeight: 0
110 | maxJumpAcrossDistance: 0
111 | minRegionArea: 2
112 | manualCellSize: 0
113 | cellSize: 0.16666667
114 | manualTileSize: 0
115 | tileSize: 256
116 | buildHeightMesh: 0
117 | maxJobWorkers: 0
118 | preserveTilesOutsideBounds: 0
119 | debug:
120 | m_Flags: 0
121 | m_NavMeshData: {fileID: 0}
122 | --- !u!1 &830374137
123 | GameObject:
124 | m_ObjectHideFlags: 0
125 | m_CorrespondingSourceObject: {fileID: 0}
126 | m_PrefabInstance: {fileID: 0}
127 | m_PrefabAsset: {fileID: 0}
128 | serializedVersion: 6
129 | m_Component:
130 | - component: {fileID: 830374139}
131 | - component: {fileID: 830374138}
132 | m_Layer: 0
133 | m_Name: Test
134 | m_TagString: Untagged
135 | m_Icon: {fileID: 0}
136 | m_NavMeshLayer: 0
137 | m_StaticEditorFlags: 0
138 | m_IsActive: 1
139 | --- !u!114 &830374138
140 | MonoBehaviour:
141 | m_ObjectHideFlags: 0
142 | m_CorrespondingSourceObject: {fileID: 0}
143 | m_PrefabInstance: {fileID: 0}
144 | m_PrefabAsset: {fileID: 0}
145 | m_GameObject: {fileID: 830374137}
146 | m_Enabled: 1
147 | m_EditorHideFlags: 0
148 | m_Script: {fileID: 11500000, guid: 331da87ca46643538dbc0df750b99383, type: 3}
149 | m_Name:
150 | m_EditorClassIdentifier:
151 | --- !u!4 &830374139
152 | Transform:
153 | m_ObjectHideFlags: 0
154 | m_CorrespondingSourceObject: {fileID: 0}
155 | m_PrefabInstance: {fileID: 0}
156 | m_PrefabAsset: {fileID: 0}
157 | m_GameObject: {fileID: 830374137}
158 | serializedVersion: 2
159 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
160 | m_LocalPosition: {x: 0, y: 0, z: 0}
161 | m_LocalScale: {x: 1, y: 1, z: 1}
162 | m_ConstrainProportionsScale: 0
163 | m_Children: []
164 | m_Father: {fileID: 0}
165 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
166 | --- !u!1 &1720212551
167 | GameObject:
168 | m_ObjectHideFlags: 0
169 | m_CorrespondingSourceObject: {fileID: 0}
170 | m_PrefabInstance: {fileID: 0}
171 | m_PrefabAsset: {fileID: 0}
172 | serializedVersion: 6
173 | m_Component:
174 | - component: {fileID: 1720212553}
175 | - component: {fileID: 1720212552}
176 | - component: {fileID: 1720212554}
177 | m_Layer: 0
178 | m_Name: Directional Light
179 | m_TagString: Untagged
180 | m_Icon: {fileID: 0}
181 | m_NavMeshLayer: 0
182 | m_StaticEditorFlags: 0
183 | m_IsActive: 1
184 | --- !u!108 &1720212552
185 | Light:
186 | m_ObjectHideFlags: 0
187 | m_CorrespondingSourceObject: {fileID: 0}
188 | m_PrefabInstance: {fileID: 0}
189 | m_PrefabAsset: {fileID: 0}
190 | m_GameObject: {fileID: 1720212551}
191 | m_Enabled: 1
192 | serializedVersion: 11
193 | m_Type: 1
194 | m_Color: {r: 1, g: 0.95686275, b: 0.8392157, a: 1}
195 | m_Intensity: 1
196 | m_Range: 10
197 | m_SpotAngle: 30
198 | m_InnerSpotAngle: 21.80208
199 | m_CookieSize: 10
200 | m_Shadows:
201 | m_Type: 2
202 | m_Resolution: -1
203 | m_CustomResolution: -1
204 | m_Strength: 1
205 | m_Bias: 0.05
206 | m_NormalBias: 0.4
207 | m_NearPlane: 0.2
208 | m_CullingMatrixOverride:
209 | e00: 1
210 | e01: 0
211 | e02: 0
212 | e03: 0
213 | e10: 0
214 | e11: 1
215 | e12: 0
216 | e13: 0
217 | e20: 0
218 | e21: 0
219 | e22: 1
220 | e23: 0
221 | e30: 0
222 | e31: 0
223 | e32: 0
224 | e33: 1
225 | m_UseCullingMatrixOverride: 0
226 | m_Cookie: {fileID: 0}
227 | m_DrawHalo: 0
228 | m_Flare: {fileID: 0}
229 | m_RenderMode: 0
230 | m_CullingMask:
231 | serializedVersion: 2
232 | m_Bits: 4294967295
233 | m_RenderingLayerMask: 1
234 | m_Lightmapping: 4
235 | m_LightShadowCasterMode: 0
236 | m_AreaSize: {x: 1, y: 1}
237 | m_BounceIntensity: 1
238 | m_ColorTemperature: 6570
239 | m_UseColorTemperature: 0
240 | m_BoundingSphereOverride: {x: 0, y: 0, z: 0, w: 0}
241 | m_UseBoundingSphereOverride: 0
242 | m_UseViewFrustumForShadowCasterCull: 1
243 | m_ForceVisible: 0
244 | m_ShadowRadius: 0
245 | m_ShadowAngle: 0
246 | m_LightUnit: 1
247 | m_LuxAtDistance: 1
248 | m_EnableSpotReflector: 1
249 | --- !u!4 &1720212553
250 | Transform:
251 | m_ObjectHideFlags: 0
252 | m_CorrespondingSourceObject: {fileID: 0}
253 | m_PrefabInstance: {fileID: 0}
254 | m_PrefabAsset: {fileID: 0}
255 | m_GameObject: {fileID: 1720212551}
256 | serializedVersion: 2
257 | m_LocalRotation: {x: 0.40821788, y: -0.23456968, z: 0.10938163, w: 0.8754261}
258 | m_LocalPosition: {x: 0, y: 3, z: 0}
259 | m_LocalScale: {x: 1, y: 1, z: 1}
260 | m_ConstrainProportionsScale: 0
261 | m_Children: []
262 | m_Father: {fileID: 0}
263 | m_LocalEulerAnglesHint: {x: 50, y: -30, z: 0}
264 | --- !u!114 &1720212554
265 | MonoBehaviour:
266 | m_ObjectHideFlags: 0
267 | m_CorrespondingSourceObject: {fileID: 0}
268 | m_PrefabInstance: {fileID: 0}
269 | m_PrefabAsset: {fileID: 0}
270 | m_GameObject: {fileID: 1720212551}
271 | m_Enabled: 1
272 | m_EditorHideFlags: 0
273 | m_Script: {fileID: 11500000, guid: 474bcb49853aa07438625e644c072ee6, type: 3}
274 | m_Name:
275 | m_EditorClassIdentifier:
276 | m_Version: 3
277 | m_UsePipelineSettings: 1
278 | m_AdditionalLightsShadowResolutionTier: 2
279 | m_LightLayerMask: 1
280 | m_RenderingLayers: 1
281 | m_CustomShadowLayers: 0
282 | m_ShadowLayerMask: 1
283 | m_ShadowRenderingLayers: 1
284 | m_LightCookieSize: {x: 1, y: 1}
285 | m_LightCookieOffset: {x: 0, y: 0}
286 | m_SoftShadowQuality: 0
287 | --- !u!1 &1776611414
288 | GameObject:
289 | m_ObjectHideFlags: 0
290 | m_CorrespondingSourceObject: {fileID: 0}
291 | m_PrefabInstance: {fileID: 0}
292 | m_PrefabAsset: {fileID: 0}
293 | serializedVersion: 6
294 | m_Component:
295 | - component: {fileID: 1776611417}
296 | - component: {fileID: 1776611416}
297 | - component: {fileID: 1776611415}
298 | m_Layer: 0
299 | m_Name: Main Camera
300 | m_TagString: MainCamera
301 | m_Icon: {fileID: 0}
302 | m_NavMeshLayer: 0
303 | m_StaticEditorFlags: 0
304 | m_IsActive: 1
305 | --- !u!81 &1776611415
306 | AudioListener:
307 | m_ObjectHideFlags: 0
308 | m_CorrespondingSourceObject: {fileID: 0}
309 | m_PrefabInstance: {fileID: 0}
310 | m_PrefabAsset: {fileID: 0}
311 | m_GameObject: {fileID: 1776611414}
312 | m_Enabled: 1
313 | --- !u!20 &1776611416
314 | Camera:
315 | m_ObjectHideFlags: 0
316 | m_CorrespondingSourceObject: {fileID: 0}
317 | m_PrefabInstance: {fileID: 0}
318 | m_PrefabAsset: {fileID: 0}
319 | m_GameObject: {fileID: 1776611414}
320 | m_Enabled: 1
321 | serializedVersion: 2
322 | m_ClearFlags: 1
323 | m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
324 | m_projectionMatrixMode: 1
325 | m_GateFitMode: 2
326 | m_FOVAxisMode: 0
327 | m_Iso: 200
328 | m_ShutterSpeed: 0.005
329 | m_Aperture: 16
330 | m_FocusDistance: 10
331 | m_FocalLength: 50
332 | m_BladeCount: 5
333 | m_Curvature: {x: 2, y: 11}
334 | m_BarrelClipping: 0.25
335 | m_Anamorphism: 0
336 | m_SensorSize: {x: 36, y: 24}
337 | m_LensShift: {x: 0, y: 0}
338 | m_NormalizedViewPortRect:
339 | serializedVersion: 2
340 | x: 0
341 | y: 0
342 | width: 1
343 | height: 1
344 | near clip plane: 0.3
345 | far clip plane: 1000
346 | field of view: 60
347 | orthographic: 0
348 | orthographic size: 5
349 | m_Depth: -1
350 | m_CullingMask:
351 | serializedVersion: 2
352 | m_Bits: 4294967295
353 | m_RenderingPath: -1
354 | m_TargetTexture: {fileID: 0}
355 | m_TargetDisplay: 0
356 | m_TargetEye: 3
357 | m_HDR: 1
358 | m_AllowMSAA: 1
359 | m_AllowDynamicResolution: 0
360 | m_ForceIntoRT: 0
361 | m_OcclusionCulling: 1
362 | m_StereoConvergence: 10
363 | m_StereoSeparation: 0.022
364 | --- !u!4 &1776611417
365 | Transform:
366 | m_ObjectHideFlags: 0
367 | m_CorrespondingSourceObject: {fileID: 0}
368 | m_PrefabInstance: {fileID: 0}
369 | m_PrefabAsset: {fileID: 0}
370 | m_GameObject: {fileID: 1776611414}
371 | serializedVersion: 2
372 | m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
373 | m_LocalPosition: {x: 0, y: 1, z: -10}
374 | m_LocalScale: {x: 1, y: 1, z: 1}
375 | m_ConstrainProportionsScale: 0
376 | m_Children: []
377 | m_Father: {fileID: 0}
378 | m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
379 | --- !u!1660057539 &9223372036854775807
380 | SceneRoots:
381 | m_ObjectHideFlags: 0
382 | m_Roots:
383 | - {fileID: 1776611417}
384 | - {fileID: 1720212553}
385 | - {fileID: 830374139}
386 |
--------------------------------------------------------------------------------