{"id":1783,"date":"2020-04-18T08:44:22","date_gmt":"2020-04-18T00:44:22","guid":{"rendered":"http:\/\/blog.coolcoding.cn\/?p=1783"},"modified":"2020-04-18T08:44:22","modified_gmt":"2020-04-18T00:44:22","slug":"unity%e4%bc%98%e5%8c%96%e8%a3%81%e5%89%aaunity%e9%aa%a8%e9%aa%bc%e5%8a%a8%e7%94%bb%e5%87%8f%e5%b0%91%e5%8a%a8%e7%94%bb%e6%96%87%e4%bb%b6%e5%ae%b9%e9%87%8f","status":"publish","type":"post","link":"https:\/\/blog.coolcoding.cn\/?p=1783","title":{"rendered":"[Unity]\u4f18\u5316\u88c1\u526aUnity\u9aa8\u9abc\u52a8\u753b,\u51cf\u5c11\u52a8\u753b\u6587\u4ef6\u5bb9\u91cf"},"content":{"rendered":"\n<p>\u6211\u4eec\u505a\u7684android\u6e38\u620f\u9879\u76ee\u5bf9\u5b89\u88c5\u5305\u6709\u5bb9\u91cf\u9650\u5236,\u539f\u5148\u662f\u9650\u5236\u5728100M\u4e4b\u5185,\u5206\u6790\u4e86\u4e00\u4e0b, Texture\u5360\u7528\u5bb9\u91cf\u6700\u591a, \u6392\u540d\u7b2c\u4e8c\u7684\u7adf\u7136\u662f \u89d2\u8272\u52a8\u753b\u6587\u4ef6<\/p>\n\n\n\n<p>\u4e00\u4e2a\u89d2\u8272\u542b\u6709\u82e5\u5e72\u4e2a\u52a8\u4f5c,\u4e00\u4e2a\u52a8\u4f5c\u6587\u4ef6\u7ea61M+\u5927\u5c0f, \u539f\u6765\u6211\u4eec\u5728PC\u4e0a\u4f7f\u7528Gamebryo\u5236\u4f5c\u7aef\u6e38\u65f6,\u4e00\u822c\u4e00\u4e2akf\u6587\u4ef6\u4e5f\u53ea\u670920KB. \u867d\u7136Unity\u7684\u52a8\u4f5c\u6570\u636e\u662f\u539f\u59cb\u6587\u672c\u6587\u4ef6, \u4f46\u4e5f\u4e0d\u81f3\u4e8e\u8fd9\u4e48\u5927\u2026<\/p>\n\n\n\n<p>\u4e0e\u7f8e\u672f\u540c\u5b66\u804a\u4e86\u4e00\u4e0b, \u60f3\u5230\u4e86\u4e00\u4e2a\u88c1\u526a\u65b9\u6848, \u7531\u4e8e\u89d2\u8272\u52a8\u753b\u4e00\u822c\u53ea\u6709\u65cb\u8f6c\u662f\u6709\u6548\u7684, \u7f29\u653e\u57fa\u672c\u4e0a\u4e0d\u7528,\u4f4d\u79fb\u7528\u5f97\u4e5f\u5f88\u5c11. \u90a3\u6211\u4eec\u53ef\u4ee5\u5236\u4f5c\u4e00\u4e2a\u81ea\u52a8\u88c1\u526a\u7684\u5de5\u5177,\u6309\u89c4\u5219\u5c06\u4e0d\u7528\u7684\u7efd\u653e\u548c\u4f4d\u79fb\u5c5e\u6027\u5e72\u6389:<\/p>\n\n\n\n<p>\u4ee5\u4e0b\u662f\u4ee3\u7801<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>static public bool SetAnimationCurveData(AnimationClip clip)\n{\n\tif (clip == null)\n\t{\n\t\treturn false;\n\t}\n \n\tAnimationClipCurveData[] curveDatas = AnimationUtility.GetAllCurves(clip, true);\n\tif (curveDatas == null)\n\t{\n\t\treturn false;\n\t}\n \n\t\/\/ \u6e05\u9664\u539f\u6765\u6240\u6709\u7684\u6570\u636e\n\tclip.ClearCurves();\n \n\tfloat len = clip.length ;\n\tforeach (AnimationClipCurveData dt in curveDatas)\n\t{\n\t\t\/\/ \u8fdb\u884c\u8fc7\u6ee4\n\t\tif (IsFilterCurveData(dt))\n\t\t{\n\t\t\tcontinue;\n\t\t}\n \n\t\t\/\/ \u5c06\u6570\u636e\u5b58\u56de\u53bb\n\t\tclip.SetCurve(dt.path, dt.type, dt.propertyName, dt.curve);\n\t}\n \n\treturn true;\n}\n \nstatic public bool SetCurveByAssetPath(string assetPath)\n{\n\tUnityEngine.Object obj = AssetDatabase.LoadAssetAtPath(assetPath, typeof(UnityEngine.Object));\n\tif (obj == null)\n\t{\n\t\treturn false;\n\t}\n\t\n\tif (!(obj is AnimationClip))\n\t{\n\t\treturn false;\n\t}\n\t\n\tAnimationClip clip = obj as AnimationClip;\n\tSetAnimationCurveData(clip, true);\n\treturn true;\n}<\/code><\/pre>\n\n\n\n<p> \u53e6\u5916\u8fd8\u6709\u4e00\u79cd\u4f18\u5316\u9009\u9879\uff0c\u628a\u4e0d\u91cd\u8981\u7684\u9aa8\u9abc\uff0c\u5bfc\u5165\u7684\u65f6\u5019\uff0c\u8fd92\u6761\u8bbe\u7f6e\u4e3a\u8f83\u5927\u7684\u503c\uff0c\u4f8b\u59823 <\/p>\n\n\n\n<figure class=\"wp-block-image\"><img decoding=\"async\" src=\"http:\/\/blog.coolcoding.cn\/wp-content\/uploads\/2020\/04\/img_5e9a4d66e0873.png\" alt=\"\"\/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u6211\u4eec\u505a\u7684android\u6e38\u620f\u9879\u76ee\u5bf9\u5b89\u88c5\u5305\u6709\u5bb9\u91cf\u9650\u5236,\u539f\u5148\u662f\u9650\u5236\u5728100M\u4e4b\u5185,\u5206\u6790\u4e86\u4e00\u4e0b, Texture\u5360\u7528\u5bb9 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"_links":{"self":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/1783"}],"collection":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1783"}],"version-history":[{"count":1,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/1783\/revisions"}],"predecessor-version":[{"id":1785,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=\/wp\/v2\/posts\/1783\/revisions\/1785"}],"wp:attachment":[{"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1783"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1783"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.coolcoding.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1783"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}