• 主页

  • 投资

  • IT

    🔥
  • 设计

  • 销售

  • 共151篇

    Unity - 游戏引擎

关闭

返回栏目

关闭

返回Unity - 游戏引擎栏目

134 - BaseManager.cs -

作者:

贺及楼

成为作者

更新日期:2023-09-17 11:00:51

BaseManager.cs

  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. //泛型、单例模式
  5. public class BaseManager<T> where T : new()
  6. {
  7. private static T instance;
  8. //单例模式
  9. public static T GetInstance()
  10. {
  11. Debug.Log("判断是否实例单例");
  12. if (instance == null)
  13. instance = new T();
  14. return instance;
  15. }
  16. }
  17. //public class GameManager : BaseManager<GameManager>
  18. //{
  19. //}