GameBootListener.cs 893 B

123456789101112131415161718192021222324
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. //游戏启动监听器(MonoBehaviour必须有,否则该类可能会被裁剪)
  5. public class GameBootListener : MonoBehaviour
  6. {
  7. //只在游戏启动时执行一次,执行顺序在场景脚本的OnEnable之后Start之前
  8. [RuntimeInitializeOnLoadMethod]
  9. private static void OnRuntimeMethodLoad()
  10. {
  11. Debug.Log("===游戏启动===");
  12. Debug.Log("===游戏初始化开始===");
  13. Object.Instantiate(Resources.Load("Prefabs/SB_EventSystem"));
  14. Debug.Log("SB_EventSystem Loaded");
  15. AudioMgr.Init();
  16. Debug.Log("AudioMgr Inited");
  17. PersistenHandler.Init();
  18. Debug.Log("PersistenHandler Inited");
  19. SmartBowLib.MsgReceiver.ins.ToString();
  20. Debug.Log("MsgReceiver Inited");
  21. Debug.Log("===游戏初始化完成===");
  22. }
  23. }