{"id":1300,"date":"2015-06-06T11:16:04","date_gmt":"2015-06-06T11:16:04","guid":{"rendered":"http:\/\/blog.zhukunqian.com\/?p=1300"},"modified":"2015-06-09T09:16:43","modified_gmt":"2015-06-09T09:16:43","slug":"%e7%9c%8b%e5%88%b0%e4%b8%80%e7%af%87%e6%96%87%e4%bb%b6%e6%af%94%e8%be%83%e7%9a%84unity%e4%b8%8b%e7%9a%84%e5%90%84%e7%a7%8d%e8%b0%83%e7%94%a8%e7%9a%84%e6%80%a7%e8%83%bd","status":"publish","type":"post","link":"https:\/\/blog.zhukunqian.com\/?p=1300","title":{"rendered":"\u770b\u5230\u4e00\u7bc7\u6587\u4ef6\u6bd4\u8f83\u7684unity\u4e0b\u7684\u5404\u79cd\u8c03\u7528\u7684\u6027\u80fd"},"content":{"rendered":"<p>http:\/\/forum.unity3d.com\/threads\/pinvoke-mono_add_internal_call-c-and-c.172886\/<\/p>\n<p>\u4ee5\u5907\u81ea\u5df1\u5b66\u4e60\u7528\u3002<\/p>\n<p>\u8fd9\u91cc\u8fd8\u6709\u4e00\u7bc7\uff1ahttp:\/\/www.snowbolt.com\/index.php\/blog\/28-tech\/91-pinvoke<\/p>\n<p>\u76ee\u524d\u770b\u8d77\u6765\uff0cmono\u8981\u6bd4c\/c++\u6162\u4e00\u4e2a\u6570\u91cf\u7ea7\uff0clua\u53c8\u6bd4mono\u6162\u4e00\u4e2a\u6570\u91cf\u7ea7\u3002<\/p>\n<p>\u5982\u679c\u60f3\u8981\u6700\u597d\u7684\u6027\u80fd\uff0c\u5e94\u8be5\u8fd8\u662flua\u76f4\u63a5\u5efa\u5728c\/c++\u4e0a\uff0c\u4f46\u662f\u53c8\u5982\u4f55\u53bb\u8c03\u7528MonoBehaviour\uff0c\u5982\u679c\u80fd\u8df3\u8fc7mono\uff0c\u76f4\u63a5\u901a\u8fc7c\/c++\u8c03\u7528\uff0c\u5219\u6027\u80fd\u5e94\u8be5\u662f\u6700\u4f18\u7684\u3002\u4f46\u662f\u9700\u8981\u786e\u8ba4\u4e0b\u5982\u4f55\u8c03\u7528\uff1f<\/p>\n<p>\u5982\u679c\u80fd\u5b9e\u73b0\uff0c\u5219\u662fc\/c++ + lua\uff0c\u76f4\u63a5\u8df3\u8fc7\u4e86 mono\u3002<\/p>\n<p>\u8fd8\u6709\u4e0d\u786e\u5b9a\u7684\u56e0\u7d20:il2cpp\u4f1a\u4e0d\u4f1a\u53ef\u4ee5\u76f4\u63a5\u5b9e\u73b0\u8fd9\u4e9b\u6027\u80fd\u63d0\u5347\uff1f\u672a\u6765\u3000\u9700\u8981\u786e\u8ba4\u4e0b\u3002<\/p>\n<p>\u7f51\u4e0a\u6709\u4f4d\u5144\u5f1f\u53cd\u7f16\u8bd1\u7684unity editor\uff0c\u770b\u4e86\u4e0b\uff0c\u4e0d\u77e5\u9053\u80fd\u5426\u5b9e\u73b0 lua \u76f4\u63a5\u50cf\u8c03\u7528c\u63a5\u53e3\u4e00\u6837\u6765\u8c03\u7528MonoBehaviour.<\/p>\n<pre class=\"brush: bash; gutter: true\">namespace UnityEngine\r\n{\r\n    using System;\r\n    using System.Collections;\r\n    using System.Runtime.CompilerServices;\r\n\r\n    public class MonoBehaviour : Behaviour\r\n    {\r\n        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]\r\n        public extern MonoBehaviour();\r\n        public void CancelInvoke()\r\n        {\r\n            this.Internal_CancelInvokeAll();\r\n        }\r\n\r\n        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]\r\n        public extern void CancelInvoke(string methodName);\r\n        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]\r\n        private extern void Internal_CancelInvokeAll();\r\n        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]\r\n        private extern bool Internal_IsInvokingAll();\r\n        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]\r\n        public extern void Invoke(string methodName, float time);\r\n        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]\r\n        public extern void InvokeRepeating(string methodName, float time, float repeatRate);\r\n        public bool IsInvoking()\r\n        {\r\n            return this.Internal_IsInvokingAll();\r\n        }\r\n\r\n        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]\r\n        public extern bool IsInvoking(string methodName);\r\n        public static void print(object message)\r\n        {\r\n            Debug.Log(message);\r\n        }\r\n\r\n        public Coroutine StartCoroutine(IEnumerator routine)\r\n        {\r\n            return this.StartCoroutine_Auto(routine);\r\n        }\r\n\r\n        public Coroutine StartCoroutine(string methodName)\r\n        {\r\n            object obj2 = null;\r\n            return this.StartCoroutine(methodName, obj2);\r\n        }\r\n\r\n        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]\r\n        public extern Coroutine StartCoroutine(string methodName, object value);\r\n        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]\r\n        public extern Coroutine StartCoroutine_Auto(IEnumerator routine);\r\n        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]\r\n        public extern void StopAllCoroutines();\r\n        [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall]\r\n        public extern void StopCoroutine(string methodName);\r\n\r\n        public bool useGUILayout { [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] get; [MethodImpl(MethodImplOptions.InternalCall), WrapperlessIcall] set; }\r\n    }\r\n}<\/pre>\n<p>\u5927\u8ba1\u7b97\u91cf\u7684\u4ee3\u7801\uff0c\u5c3d\u91cf\u907f\u514d\u4f7f\u7528c#\u4ee3\u7801\uff0c\u80fd\u7528c\/c++\u5b9e\u73b0\uff0c\u5c31\u4f7f\u7528c\/c++\u5b9e\u73b0\uff0c\u7136\u540e\u66b4\u9732\u63a5\u53e3\u7ed9c#\u5c42\u4f7f\u7528\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>http:\/\/forum.unity3d.com\/threads\/pinvoke &hellip;<\/p>\n<p class=\"read-more\"><a href=\"https:\/\/blog.zhukunqian.com\/?p=1300\">\u7ee7\u7eed\u9605\u8bfb &raquo;<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/posts\/1300"}],"collection":[{"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1300"}],"version-history":[{"count":6,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/posts\/1300\/revisions"}],"predecessor-version":[{"id":1321,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=\/wp\/v2\/posts\/1300\/revisions\/1321"}],"wp:attachment":[{"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1300"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1300"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.zhukunqian.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1300"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}