别处看来的:有大佬知道啥原理烦请留言指教下
using UnityEngine;
using System.Collections;public class TestSingelScript : MonoBehaviour
{
public static TestSingelScript instance;
//这个运行时候new这个类也好,挂2个相同脚本也好,只会执行一次static TestSingelScript()这个方法,比Awake还要先执行
static TestSingelScript(){
Debug.Log("TestSingelScript");
}
public void DoSomeThings()
{
Debug.Log(1111);
}
// Use this for initialization
void Start () {
Debug.Log("Start");
}
// Update is called once per frame
void Update () {
}
}