单例模式
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Script_04_05 : MonoBehaviour
{
public static Script_04_05 instance;
static Script_04_05()
{
GameObject go = new GameObject("#zyf#");
DontDestroyOnLoad(go);
go.AddComponent<Script_04_05>();
}
public void DoSomeThing()
{
Debug.Log("zyf DoSomeThing");
}
private void Start()
{
Debug.Log("Start");
}
}