using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CanvasDS : MonoBehaviour
{
//声明单例,判断其在场景中是否已存在(被赋值)
public static CanvasDS instance;

void Awake()
{
    if (instance != null)
    {
        Destroy(gameObject);//已存在与场景中时销毁此对象,保证场景中只有一个此类对象
        return;
    }
    instance = this;
    DontDestroyOnLoad(this);
}

}