#include <CCRef.h> Ref is used for reference count manangement. If a classinherits from Ref. Class Ref 为引用计数类,用来管理对象的引用计数. 这样就不会出现还有指针保持指向该对象,当使用该指针操作时,假设指向的对象被销毁就会出现程序异常. class CC_DLL Ref { public: void retain();//添加引用计数一次 void release();//降低引用计数一次…
Singleton.cs 12345678910111213 using UnityEngine;/// <summary>/// 单例模版类/// </summary>public class Singleton<T> where T : new() { private static readonly T instance = new T(); public static T Instance{ get{ return instance; } }} MonoSingl…