Init.cs 624 B

12345678910111213141516171819202122232425262728
  1. using System;
  2. using System.Reflection;
  3. using UnityEngine;
  4. namespace Base
  5. {
  6. public class Init : MonoBehaviour
  7. {
  8. public Action UpdateAction;
  9. private void Start()
  10. {
  11. GameObject code = (GameObject)Resources.Load("Code/Code");
  12. byte[] assBytes = code.Get<TextAsset>("Controller.dll").bytes;
  13. byte[] mdbBytes = code.Get<TextAsset>("Controller.dll.mdb").bytes;
  14. Assembly assembly = Assembly.Load(assBytes, mdbBytes);
  15. MethodInfo methodInfo = assembly.GetType("Controller.Init").GetMethod("Start");
  16. methodInfo.Invoke(null, null);
  17. }
  18. private void Update()
  19. {
  20. this.UpdateAction?.Invoke();
  21. }
  22. }
  23. }