单例模式分为两种一种是继承mono的一种是不继承mono的
不继承mono的 常用于数据的管理
不继承mono:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
namespace Sington
{
public class SingleTonTest /*: MonoBehaviour */
{
//不继承mono的单利 常用于数据的管理类
public string name = "VR-1";
//存储 当前类唯一实例的对象
private static SingleTonTest instance;
//需要一个位置对当前对象进行实例化 而且是唯一的实例化
//public static SingleTonTest GetInstance()
//{
// if (instance == null)
//