1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
 
public class InGameManager : MonoBehaviour
{
    private static InGameManager _instance;
 
    public static InGameManager Instance
    {
        get
        {
            if(_instance == null)
            {
                _instance = GameObject.FindObjectOfType(typeof(InGameManager)) as InGameManager;
                if (_instance == null)
                {
                    GameObject ingameManager = new GameObject();
                    ingameManager.name = "InGameManager";
                    _instance = ingameManager.AddComponent<InGameManager>();
                }
            }
            return _instance;
        }
    }
 
    private void Awake()
    {
        DontDestroyOnLoad(this);
    }
 
}
http://colorscripter.com/info#e" target="_blank" style="color:#4f4f4ftext-decoration:none">Colored by Color Scripter
 
 

 

Posted by Dongkey
,