Ejemplo n.º 1
0
 private void TryInvoke(MonoBehaviourMethod method)
 {
     IntPtr ptr = FuncPtr[(int)method];
     if (ptr != IntPtr.Zero)
     {
         InvokeFunction(ptr);
     }
 }
Ejemplo n.º 2
0
        public void Init()
        {
            for (int i = 0; i < FuncPtr.Length; i++)
            {
                MonoBehaviourMethod method = (MonoBehaviourMethod)i;
                FuncPtr[i] = WrapperUtils.GetFuncPtr(this, method.ToString());

                if (FuncPtr[i] != IntPtr.Zero)
                    Debug.LogError("bind method: " + method);
            }

            if(awakeAfterInit)
            {
                TryInvoke(MonoBehaviourMethod.Awake);
                awakeAfterInit = false;
            }
        }
Ejemplo n.º 3
0
        private static void SetEssentialsMethods(IntPtr assemblyHandle)
        {
            _setDebugLog = NativeAssembly.GetMethod <SetUnityDebugLogDelegate>(assemblyHandle, "SetUnityDebugLogMethod");
            _setDebugLog.Invoke(DebugLog);

            _setUnitySendMessage = NativeAssembly.GetMethod <SetSendMessageDelegate>(assemblyHandle, "SetUnitySendMessageMethod");
            _setUnitySendMessage.Invoke(UnitySendMessageMethod);

            createNativeMonoBehaviour  = NativeAssembly.GetMethod <CreateNativeMonoBehaviourInstance>(assemblyHandle, "CreateNativeMonoBehaviourInstance");
            destroyNativeMonoBehaviour = NativeAssembly.GetMethod <DestroyNativeMonoBehaviourInstance>(assemblyHandle, "DestroyNativeMonoBehaviourInstance");
            monoBehaviourAwake         = NativeAssembly.GetMethod <MonoBehaviourMethod>(assemblyHandle, "CallMonoBehaviourAwake");
            monoBehaviourOnDestroy     = NativeAssembly.GetMethod <MonoBehaviourMethod>(assemblyHandle, "CallMonoBehaviourOnDestroy");
            monoBehaviourStart         = NativeAssembly.GetMethod <MonoBehaviourMethod>(assemblyHandle, "CallMonoBehaviourStart");
            monoBehaviourStop          = NativeAssembly.GetMethod <MonoBehaviourMethod>(assemblyHandle, "CallMonoBehaviourStop");
            monoBehaviourOnEnable      = NativeAssembly.GetMethod <MonoBehaviourMethod>(assemblyHandle, "CallMonoBehaviourOnEnable");
            monoBehaviourOnDisable     = NativeAssembly.GetMethod <MonoBehaviourMethod>(assemblyHandle, "CallMonoBehaviourOnDisable");
            monoBehaviourFixedUpdate   = NativeAssembly.GetMethod <MonoBehaviourMethod>(assemblyHandle, "CallMonoBehaviourFixedUpdate");
            monoBehaviourUpdate        = NativeAssembly.GetMethod <MonoBehaviourMethod>(assemblyHandle, "CallMonoBehaviourUpdate");
            monoBehaviourLateUpdate    = NativeAssembly.GetMethod <MonoBehaviourMethod>(assemblyHandle, "CallMonoBehaviourLateUpdate");
        }