{"id":2385,"date":"2021-05-18T11:10:32","date_gmt":"2021-05-18T03:10:32","guid":{"rendered":"http:\/\/1vr.cn\/?p=2385"},"modified":"2021-05-18T11:10:43","modified_gmt":"2021-05-18T03:10:43","slug":"unityscript%e8%b8%8f%e5%85%a5%e5%a4%95%e9%98%b3%e7%9a%84%e6%bc%ab%e6%bc%ab%e9%95%bf%e8%b7%af","status":"publish","type":"post","link":"https:\/\/1vr.cn\/?p=2385","title":{"rendered":"UnityScript\u8e0f\u5165\u5915\u9633\u7684\u6f2b\u6f2b\u957f\u8def"},"content":{"rendered":"\n<p>It\u2019s been with us since Unity 1.0, but its time is finally coming: we have begun the deprecation process for UnityScript, the JavaScript-like scripting language available as an alternative to C# in Unity today.<\/p>\n\n\n\n<p>\u81ea\u4eceUnity 1.0\u4ee5\u6765\uff0c\u6211\u4eec\u5c31\u4e00\u76f4\u5728\u4f7f\u7528\u5b83\uff0c\u4f46\u662f\u5b83\u7684\u65f6\u673a\u7ec8\u4e8e\u5230\u4e86\uff1a\u6211\u4eec\u5df2\u7ecf\u5f00\u59cb\u5f03\u7528UnityScript\uff0c\u8fd9\u662f\u4e00\u79cd\u7c7b\u4f3c\u4e8eJavaScript\u7684\u811a\u672c\u8bed\u8a00\uff0c\u5982\u4eca\u5df2\u6210\u4e3aUnity\u4e2dC\uff03\u7684\u66ff\u4ee3\u8bed\u8a00\u3002&nbsp;<\/p>\n\n\n\n<p>In this blog post, we\u2019ll go into the details behind the decision, but to briefly summarise: continued support for UnityScript is obstructing our ability to deliver new scripting-related features, and only about 3.6% of projects are using it heavily.<\/p>\n\n\n\n<p>\u5728\u6b64\u535a\u5ba2\u6587\u7ae0\u4e2d\uff0c\u6211\u4eec\u5c06\u8be6\u7ec6\u8ba8\u8bba\u8be5\u51b3\u7b56\u80cc\u540e\u7684\u7ec6\u8282\uff0c\u4f46\u7b80\u8981\u5730\u603b\u7ed3\u4e00\u4e0b\uff1a\u5bf9UnityScript\u7684\u6301\u7eed\u652f\u6301\u963b\u788d\u4e86\u6211\u4eec\u4ea4\u4ed8\u4e0e\u811a\u672c\u76f8\u5173\u7684\u65b0\u529f\u80fd\u7684\u80fd\u529b\uff0c\u53ea\u6709\u5927\u7ea63.6\uff05\u7684\u9879\u76ee\u6b63\u5728\u5927\u91cf\u4f7f\u7528\u5b83\u3002&nbsp;<\/p>\n\n\n\n<!--more-->\n\n\n\n<h3 class=\"wp-block-heading\">\u4e3a\u4ec0\u4e48\u4e0d\u8d5e\u6210\uff1f&nbsp;<strong>(<\/strong>Why deprecate it?<strong>)<\/strong><\/h3>\n\n\n\n<p>Every time we remove something from Unity, we assume there are always&nbsp;<em>some<\/em>&nbsp;users that it\u2019s going to inconvenience. So, it\u2019s important that we have made sure our reasons are worthwhile.<\/p>\n\n\n\n<p>\u6bcf\u6b21\u6211\u4eec\u4eceUnity\u4e2d\u5220\u9664\u67d0\u4e9b\u5185\u5bb9\u65f6\uff0c\u6211\u4eec\u90fd\u4f1a\u5047\u8bbe\u603b\u4f1a&nbsp;<em>\u6709\u4e00\u4e9b<\/em>&nbsp;\u7528\u6237\u611f\u5230\u4e0d\u4fbf\u3002 \u56e0\u6b64\uff0c\u91cd\u8981\u7684\u662f\u6211\u4eec\u5fc5\u987b\u786e\u4fdd\u6211\u4eec\u7684\u7406\u7531\u503c\u5f97\u3002&nbsp;<\/p>\n\n\n\n<p>There\u2019s a lot happening around scripting at Unity right now. Some of the biggest pieces:<\/p>\n\n\n\n<p>\u73b0\u5728\uff0cUnity\u4e0a\u7684\u811a\u672c\u7f16\u5199\u6b63\u5728\u53d1\u751f\u5f88\u591a\u4e8b\u60c5\u3002 \u4e00\u4e9b\u6700\u5927\u7684\u4f5c\u54c1\uff1a&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>The Scripting Runtime upgrade, which brings the ability to use .NET 4.6 and C# 6.\u811a\u672c\u8fd0\u884c\u65f6\u5347\u7ea7\uff0c\u5e26\u6765\u4e86\u4f7f\u7528.NET 4.6\u548cC\uff036\u7684\u80fd\u529b\u3002&nbsp;<\/li><li>The JobSystem, making it possible to easily write multithreaded code in a way that protects you against race conditions and deadlocks.JobSystem\uff0c\u4f7f\u60a8\u53ef\u4ee5\u8f7b\u677e\u7f16\u5199\u591a\u7ebf\u7a0b\u4ee3\u7801\uff0c\u4ece\u800c\u4fdd\u62a4\u60a8\u514d\u53d7\u7ade\u4e89\u72b6\u51b5\u548c\u6b7b\u9501\u7684\u4fb5\u5bb3\u3002&nbsp;<\/li><li>The NativeArray type, allowing you to create and work with large arrays that have their storage controlled by native code, giving you more control over allocation behaviour and exempting you from garbage collection concerns.NativeArray\u7c7b\u578b\uff0c\u4f7f\u60a8\u53ef\u4ee5\u521b\u5efa\u548c\u4f7f\u7528\u5176\u5b58\u50a8\u53d7\u672c\u673a\u4ee3\u7801\u63a7\u5236\u7684\u5927\u578b\u9635\u5217\uff0c\u4ece\u800c\u4f7f\u60a8\u53ef\u4ee5\u66f4\u597d\u5730\u63a7\u5236\u5206\u914d\u884c\u4e3a\uff0c\u5e76\u4f7f\u60a8\u4e0d\u5fc5\u62c5\u5fc3\u5783\u573e\u56de\u6536\u95ee\u9898\u3002&nbsp;<\/li><li>Control over the script compilation pipeline, so you can customize how your scripts are combined into assemblies.\u63a7\u5236\u811a\u672c\u7f16\u8bd1\u7ba1\u9053\uff0c\u56e0\u6b64\u60a8\u53ef\u4ee5\u81ea\u5b9a\u4e49\u5982\u4f55\u5c06\u811a\u672c\u7ec4\u5408\u5230\u7a0b\u5e8f\u96c6\u4e2d\u3002&nbsp;<\/li><\/ul>\n\n\n\n<p>That\u2019s just a fraction of what we\u2019re working on right now \u2013 there are many more things happening, and that doesn\u2019t even include some of the projects we have planned for the future. In addition to the specific scripting projects, we\u2019re also increasingly opening up the engine and growing our API surface \u2013 which we want to do using the most appropriate language constructs available.<\/p>\n\n\n\n<p>\u8fd9\u53ea\u662f\u6211\u4eec\u76ee\u524d\u6b63\u5728\u505a\u7684\u4e8b\u60c5\u7684\u4e00\u5c0f\u90e8\u5206-\u8fd8\u6709\u66f4\u591a\u7684\u4e8b\u60c5\u6b63\u5728\u53d1\u751f\uff0c\u751a\u81f3\u8fd8\u4e0d\u5305\u62ec\u6211\u4eec\u4e3a\u672a\u6765\u8ba1\u5212\u7684\u4e00\u4e9b\u9879\u76ee\u3002 \u9664\u4e86\u7279\u5b9a\u7684\u811a\u672c\u9879\u76ee\u4e4b\u5916\uff0c\u6211\u4eec\u8fd8\u8d8a\u6765\u8d8a\u591a\u5730\u5f00\u653e\u5f15\u64ce\u5e76\u6269\u5c55\u6211\u4eec\u7684API\u8868\u9762-\u6211\u4eec\u5e0c\u671b\u4f7f\u7528\u53ef\u7528\u7684\u6700\u5408\u9002\u7684\u8bed\u8a00\u6784\u9020\u6765\u505a\u5230\u8fd9\u4e00\u70b9\u3002&nbsp;<\/p>\n\n\n\n<p>Today, UnityScript and C# are fairly evenly matched in terms of functionality and performance: there\u2019s nothing you can do with C# that you cannot do with UnityScript. C# is the clear winner when it comes to developer ecosystem \u2013 not just the millions of C# tutorials and samples out there, but also tooling support, like refactoring and intellisense in Visual Studio \u2013 but you could say, today, that UnityScript&nbsp;<em>works<\/em>, and who needs those fancy tools anyway?<\/p>\n\n\n\n<p>\u4eca\u5929\uff0c\u5728\u529f\u80fd\u548c\u6027\u80fd\u65b9\u9762\uff0cUnityScript\u548cC\uff03\u7684\u5339\u914d\u7a0b\u5ea6\u76f8\u5f53\u5747\u5300\uff1a\u5bf9\u4e8eC\uff03\uff0c\u60a8\u65e0\u80fd\u4e3a\u529b\uff0c\u800c\u5bf9UnityScript\u5219\u65e0\u80fd\u4e3a\u529b\u3002 \u5728\u5f00\u53d1\u4eba\u5458\u751f\u6001\u7cfb\u7edf\u65b9\u9762\uff0cC\uff03\u65e0\u7591\u662f\u8d62\u5bb6\u2013\u4e0d\u4ec5\u6709\u6570\u767e\u4e07\u7684C\uff03\u6559\u7a0b\u548c\u793a\u4f8b\uff0c\u8fd8\u63d0\u4f9b\u4e86\u5de5\u5177\u652f\u6301\uff0c\u4f8b\u5982Visual Studio\u4e2d\u7684\u91cd\u6784\u548c\u667a\u80fd\u611f\u77e5\u2013\u4f46\u4eca\u5929\u60a8\u53ef\u4ee5\u8bf4UnityScript&nbsp;<em>\u53ef\u4ee5\u5de5\u4f5c<\/em>&nbsp;\uff0c\u4ee5\u53ca\u8c01\u8fd8\u662f\u9700\u8981\u90a3\u4e9b\u7cbe\u7f8e\u7684\u5de5\u5177\uff1f&nbsp;<\/p>\n\n\n\n<p>It\u2019s true today, but it won\u2019t be true forever. As we upgrade the Scripting Runtime and version of C# we support, there will begin to be things that UnityScript doesn\u2019t do as well as C#, or even can\u2019t do at all. It already does not support default values for method parameters, and there are more language features coming to C#, such as ref return, that will have the same problem. We don\u2019t use these language features in the API today, but we want to, both for performance and to achieve a clean API design.<\/p>\n\n\n\n<p>\u4eca\u5929\u662f\u5bf9\u7684\uff0c\u4f46\u4e0d\u4f1a\u6c38\u8fdc\u5982\u6b64\u3002 \u5f53\u6211\u4eec\u5347\u7ea7\u811a\u672c\u8fd0\u884c\u65f6\u548c\u6211\u4eec\u652f\u6301\u7684C\uff03\u7248\u672c\u65f6\uff0c\u5c06\u5f00\u59cb\u51fa\u73b0UnityScript\u4e0d\u5982C\uff03\u751a\u81f3\u6839\u672c\u65e0\u6cd5\u5b8c\u6210\u7684\u4e8b\u60c5\u3002 \u5b83\u5df2\u7ecf\u4e0d\u652f\u6301\u65b9\u6cd5\u53c2\u6570\u7684\u9ed8\u8ba4\u503c\uff0c\u5e76\u4e14C\uff03\u5f15\u5165\u4e86\u66f4\u591a\u7684\u8bed\u8a00\u529f\u80fd\uff0c\u4f8b\u5982 ref return \uff0c\u5c06\u5177\u6709\u76f8\u540c\u7684\u95ee\u9898\u3002 \u6211\u4eec\u4eca\u5929\u4e0d\u5728API\u4e2d\u4f7f\u7528\u8fd9\u4e9b\u8bed\u8a00\u529f\u80fd\uff0c\u4f46\u6211\u4eec\u5e0c\u671b\u8fd9\u6837\u505a\u65e2\u53ef\u4ee5\u63d0\u9ad8\u6027\u80fd\uff0c\u53c8\u53ef\u4ee5\u5b9e\u73b0\u7b80\u6d01\u7684API\u8bbe\u8ba1\u3002&nbsp;<\/p>\n\n\n\n<p>It\u2019s all just software, and we&nbsp;<em>could<\/em>&nbsp;take the time to implement these missing pieces into UnityScript. Time is not free, though; asking an engineer to work on bringing UnityScript up-to-date means taking them away from working on something else (like one of the new features I mentioned above \u2013 or just from fixing bugs). This isn\u2019t even mentioning the time we&nbsp;<em>already<\/em>&nbsp;invest in maintaining UnityScript \u2013 supporting it in the Script Updater, supporting it in the documentation, and so on.<\/p>\n\n\n\n<p>\u8fd9\u4e9b\u5168\u90fd\u662f\u8f6f\u4ef6\uff0c\u6211\u4eec&nbsp;<em>\u53ef\u4ee5<\/em>&nbsp;\u82b1\u4e00\u4e9b\u65f6\u95f4\u5c06\u8fd9\u4e9b\u9057\u6f0f\u7684\u90e8\u5206\u5b9e\u73b0\u5230UnityScript\u4e2d\u3002 \u65f6\u95f4\u4e0d\u662f\u514d\u8d39\u7684\u3002 \u8981\u6c42\u5de5\u7a0b\u5e08\u52aa\u529b\u4f7fUnityScript\u4fdd\u6301\u6700\u65b0\u72b6\u6001\uff0c\u5c31\u610f\u5473\u7740\u4ed6\u4eec\u5c06\u65e0\u6cd5\u4ece\u4e8b\u5176\u4ed6\u5de5\u4f5c(\u4f8b\u5982\u4e0a\u9762\u63d0\u5230\u7684\u65b0\u529f\u80fd\u4e4b\u4e00\uff0c\u6216\u8005\u4ec5\u4ec5\u662f\u4fee\u590dbug)\u3002 \u751a\u81f3\u6ca1\u6709\u63d0\u5230\u6211\u4eec&nbsp;<em>\u5df2\u7ecf\u82b1<\/em>&nbsp;\u4e86\u5f88\u591a\u65f6\u95f4 \u6765\u7ef4\u62a4UnityScript-\u5728Script Updater\u4e2d\u652f\u6301\u5b83\uff0c\u5728\u6587\u6863\u4e2d\u652f\u6301\u5b83\uff0c\u7b49\u7b49\u3002&nbsp;<\/p>\n\n\n\n<p>So let\u2019s look at the other side of this: how many users will be affected? The Editor periodically sends us data about your project, including the different file types you\u2019re using and how much you\u2019re using them, so from that we can calculate statistics about how many projects are actually using UnityScript. What we found was:<\/p>\n\n\n\n<p>\u56e0\u6b64\uff0c\u8ba9\u6211\u4eec\u770b\u4e00\u4e0b\u53e6\u4e00\u65b9\u9762\uff1a\u4f1a\u5f71\u54cd\u591a\u5c11\u7528\u6237\uff1f \u7f16\u8f91\u5668\u4f1a\u5b9a\u671f\u5411\u6211\u4eec\u53d1\u9001\u6709\u5173\u60a8\u7684\u9879\u76ee\u7684\u6570\u636e\uff0c\u5305\u62ec\u60a8\u6b63\u5728\u4f7f\u7528\u7684\u4e0d\u540c\u6587\u4ef6\u7c7b\u578b\u4ee5\u53ca\u4f7f\u7528\u4e86\u591a\u5c11\u6587\u4ef6\uff0c\u56e0\u6b64\u6211\u4eec\u53ef\u4ee5\u8ba1\u7b97\u51fa\u5b9e\u9645\u4e0a\u6709\u591a\u5c11\u4e2a\u9879\u76ee\u6b63\u5728\u4f7f\u7528UnityScript\u3002 \u6211\u4eec\u53d1\u73b0\u7684\u662f\uff1a&nbsp;<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>To date, of all the projects that have used Unity 5.6, about 14.6% of them have at least one file with a .js extension in it. 14.6% sounds quite high, but then we broke the numbers down further, and looked at how many files were .js files as a fraction of total script files in the project (.js + .cs).\u8fc4\u4eca\u4e3a\u6b62\uff0c\u5728\u6240\u6709\u4f7f\u7528Unity 5.6\u7684\u9879\u76ee\u4e2d\uff0c\u5927\u7ea6\u670914.6\uff05\u7684\u9879\u76ee\u81f3\u5c11\u5305\u542b\u4e00\u4e2a\u5e26\u6709.js\u6269\u5c55\u540d\u7684\u6587\u4ef6\u3002 14.6\uff05\u7684\u58f0\u97f3\u542c\u8d77\u6765\u5f88\u9ad8\uff0c\u4f46\u662f\u6211\u4eec\u8fdb\u4e00\u6b65\u7ec6\u5206\u4e86\u6570\u5b57\uff0c\u7136\u540e\u67e5\u770b\u4e86.js\u6587\u4ef6\u4e2d\u5360\u6587\u4ef6\u603b\u6570(.js + .cs)\u7684\u4e00\u5c0f\u90e8\u5206\u7684\u6587\u4ef6\u6570\u3002&nbsp;<\/li><li>So, that leaves 85.4% of all projects which are&nbsp;<em>entirely<\/em>&nbsp;in C#, with no UnityScript files at all.\u56e0\u6b64\uff0c\u5269\u4e0b\u7684\u6240\u6709\u9879\u76ee\u4e2d\u670985.4\uff05&nbsp;<em>\u5b8c\u5168<\/em>\u662fC\uff03\uff0c\u6839\u672c\u6ca1\u6709UnityScript\u6587\u4ef6\u3002&nbsp;<\/li><li>9.5% of all projects are&nbsp;<em>mostly<\/em>&nbsp;in C# \u2013 they have some UnityScript files, but fewer than 10% of their total script file count. Another 1.5% of all projects have between 10% and 20% of their code in UnityScript files.\u6240\u6709\u9879\u76ee\u76849.5\uff05&nbsp;<em>\u4e3b\u8981<\/em>&nbsp;\u662fC\uff03\u2013\u5b83\u4eec\u5177\u6709\u4e00\u4e9bUnityScript\u6587\u4ef6\uff0c\u4f46\u5c11\u4e8e\u811a\u672c\u6587\u4ef6\u603b\u6570\u768410\uff05\u3002 \u5728\u6240\u6709\u9879\u76ee\u4e2d\uff0c\u53e6\u67091.5\uff05\u7684\u4ee3\u7801\u5728UnityScript\u6587\u4ef6\u4e2d\u536010\uff05\u81f320\uff05\u3002&nbsp;<\/li><li>That leaves 3.6% of all projects that have more than 20% of their code in UnityScript.\u5269\u4e0b\u76843.6\uff05\u7684\u9879\u76ee\u5728UnityScript\u4e2d\u62e5\u6709\u8d85\u8fc720\uff05\u7684\u4ee3\u7801\u3002&nbsp;<\/li><li>Only 0.8% of all projects are exclusively (i.e. 100%) in UnityScript.\u6240\u6709\u9879\u76ee\u4e2d\u53ea\u67090.8\uff05\u662fUnityScript\u4e2d\u4e13\u6709\u7684(\u5373100\uff05)\u3002&nbsp;<\/li><\/ul>\n\n\n\n<p>What this suggests to us is that the majority of you who still have UnityScript code aren\u2019t using it heavily. You may even not be actively using it at all: a .js file in the project might be an example script for an Asset Store package, rather than code that you are actually relying on. Therefore, an early step in our deprecation plan is to start working with Asset Store publishers to get rid of packages that are providing these files \u2013 more on this below.<\/p>\n\n\n\n<p>\u8fd9\u5411\u6211\u4eec\u8868\u660e\uff0c\u4ecd\u7136\u6709UnityScript\u4ee3\u7801\u7684\u5927\u591a\u6570\u4eba\u5e76\u672a\u5927\u91cf\u4f7f\u7528\u5b83\u3002 \u60a8\u751a\u81f3\u53ef\u80fd\u6839\u672c\u6ca1\u6709\u79ef\u6781\u4f7f\u7528\u5b83\uff1a\u9879\u76ee\u4e2d\u7684.js\u6587\u4ef6\u53ef\u80fd\u662fAsset Store\u8f6f\u4ef6\u5305\u7684\u793a\u4f8b\u811a\u672c\uff0c\u800c\u4e0d\u662f\u60a8\u5b9e\u9645\u4f9d\u8d56\u7684\u4ee3\u7801\u3002 \u56e0\u6b64\uff0c\u6211\u4eec\u5f03\u7528\u8ba1\u5212\u7684\u65e9\u671f\u6b65\u9aa4\u662f\u5f00\u59cb\u4e0eAsset Store\u53d1\u5e03\u8005\u5408\u4f5c\uff0c\u4ee5\u6446\u8131\u63d0\u4f9b\u8fd9\u4e9b\u6587\u4ef6\u7684\u8f6f\u4ef6\u5305-\u6709\u5173\u66f4\u591a\u4fe1\u606f\uff0c\u8bf7\u53c2\u89c1\u4e0b\u6587\u3002&nbsp;<\/p>\n\n\n\n<p>To the 3.6% of you who are using it more heavily \u2013 and especially the 0.8% who are using it exclusively \u2013 we are sorry. We know that this decision sucks for you. We\u2019re taking some steps to try and smooth the transition, that I\u2019ll describe below; and we hope that you will eventually agree with us that it was worth it in the end.<\/p>\n\n\n\n<p>\u5bf9\u4e8e3.6\uff05\u7684\u7528\u6237(\u5c24\u5176\u662f\u4ec5\u4f7f\u75280.8\uff05\u7684\u7528\u6237)\u4f7f\u7528\u7387\u66f4\u9ad8\uff0c\u6211\u4eec\u6df1\u8868\u6b49\u610f\u3002 \u6211\u4eec\u77e5\u9053\u8fd9\u4e2a\u51b3\u5b9a\u5bf9\u60a8\u5f88\u4e0d\u5229\u3002 \u6211\u4eec\u6b63\u5728\u91c7\u53d6\u4e00\u4e9b\u6b65\u9aa4\u6765\u5c1d\u8bd5\u5e73\u6ed1\u8fc7\u6e21\uff0c\u4e0b\u9762\u5c06\u5bf9\u6b64\u8fdb\u884c\u4ecb\u7ecd\uff1b \u6211\u4eec\u5e0c\u671b\u60a8\u6700\u7ec8\u4f1a\u540c\u610f\u6211\u4eec\u7684\u770b\u6cd5\uff0c\u8fd9\u6700\u7ec8\u662f\u503c\u5f97\u7684\u3002&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u600e\u4e48\u4f1a\u8fd9\u6837&nbsp;<strong>(<\/strong>How will it happen?<strong>)<\/strong><\/h3>\n\n\n\n<p>We\u2019re not just going to pull the plug overnight. Here\u2019s what you\u2019re going to see us do:<\/p>\n\n\n\n<p>\u6211\u4eec\u4e0d\u53ea\u662f\u4e00\u591c\u4e4b\u95f4\u62d4\u6389\u63d2\u5934\u3002 \u8fd9\u662f\u60a8\u8981\u6211\u4eec\u770b\u5230\u7684\u5185\u5bb9\uff1a&nbsp;<\/p>\n\n\n\n<p>Firstly, as of the beginning of June, we have amended the Asset Store submission policy to reject packages that contain UnityScript code. All new code that you\u2019re writing for Asset Store packages should be in C#. (We ran this past the Asset Store Publishers discussion group before we did this, to give them a heads-up). Soon, we will begin a scan of all existing packages on the Asset Store to find ones that contain UnityScript files, and will contact publishers to ask them to port their code to C#. After a while, any package that hasn\u2019t been ported will be removed from the store.<\/p>\n\n\n\n<p>\u9996\u5148\uff0c\u4ece6\u6708\u521d\u5f00\u59cb\uff0c\u6211\u4eec\u5df2\u7ecf\u4fee\u6539\u4e86\u8d44\u4ea7\u5546\u5e97\u63d0\u4ea4\u653f\u7b56\uff0c\u4ee5\u62d2\u7edd\u5305\u542bUnityScript\u4ee3\u7801\u7684\u8f6f\u4ef6\u5305\u3002 \u60a8\u4e3aAsset Store\u8f6f\u4ef6\u5305\u7f16\u5199\u7684\u6240\u6709\u65b0\u4ee3\u7801\u90fd\u5e94\u4f7f\u7528C\uff03\u3002 (\u5728\u8fdb\u884c\u6b64\u64cd\u4f5c\u4e4b\u524d\uff0c\u6211\u4eec\u5148\u7ecf\u8fc7\u4e86Asset Store Publishers\u8ba8\u8bba\u7ec4\uff0c\u4ee5\u4f7f\u4ed6\u4eec\u6709\u6240\u4e86\u89e3)\u3002 \u5f88\u5feb\uff0c\u6211\u4eec\u5c06\u5f00\u59cb\u626b\u63cf\u8d44\u4ea7\u5546\u5e97\u4e2d\u7684\u6240\u6709\u73b0\u6709\u8f6f\u4ef6\u5305\uff0c\u4ee5\u67e5\u627e\u5305\u542bUnityScript\u6587\u4ef6\u7684\u8f6f\u4ef6\u5305\uff0c\u5e76\u5c06\u4e0e\u53d1\u5e03\u8005\u8054\u7cfb\uff0c\u8981\u6c42\u4ed6\u4eec\u5c06\u4ee3\u7801\u79fb\u690d\u5230C\uff03\u3002 \u4e00\u6bb5\u65f6\u95f4\u540e\uff0c\u6240\u6709\u5c1a\u672a\u79fb\u690d\u7684\u8f6f\u4ef6\u5305\u90fd\u5c06\u4ece\u5546\u5e97\u4e2d\u5220\u9664\u3002&nbsp;<\/p>\n\n\n\n<p>Secondly, you might have already noticed: the Unity 2017.2 beta no longer has a \u2018<em>Javascript<\/em>\u2019 (a.k.a UnityScript) option in the Create Assets menu. All we have done at this point is remove the menu item; all the support is still there, and you will still be able to create new UnityScript files outside of Unity (for example, via MonoDevelop). We\u2019re doing this to help ensure that new users do not continue to adopt UnityScript; it would be irresponsible of us to let them invest time in learning it when it is not long for this world.<\/p>\n\n\n\n<p>\u5176\u6b21\uff0c\u60a8\u53ef\u80fd\u5df2\u7ecf\u6ce8\u610f\u5230\uff1aUnity 2017.2 beta \u5728\u201c\u521b\u5efa\u8d44\u4ea7\u201d\u83dc\u5355\u4e2d \u4e0d\u518d\u5177\u6709\u201c&nbsp;<em>Javascript<\/em>&nbsp;\u201d(\u53c8\u540dUnityScript)\u9009\u9879\u3002 \u81f3\u6b64\uff0c\u6211\u4eec\u8981\u505a\u7684\u5c31\u662f\u5220\u9664\u83dc\u5355\u9879\u3002 \u6240\u6709\u7684\u652f\u6301\u4ecd\u7136\u5b58\u5728\uff0c\u60a8\u4ecd\u7136\u53ef\u4ee5\u5728Unity\u4e4b\u5916\u521b\u5efa\u65b0\u7684UnityScript\u6587\u4ef6(\u4f8b\u5982\uff0c\u901a\u8fc7MonoDevelop)\u3002 \u6211\u4eec\u8fd9\u6837\u505a\u662f\u4e3a\u4e86\u786e\u4fdd\u65b0\u7528\u6237\u4e0d\u4f1a\u7ee7\u7eed\u91c7\u7528UnityScript\u3002 \u5f53\u8fd9\u4e2a\u4e16\u754c\u4e0d\u957f\u65f6\uff0c\u8ba9\u4ed6\u4eec\u82b1\u65f6\u95f4\u53bb\u5b66\u4e60\u5b83\u662f\u4e0d\u8d1f\u8d23\u4efb\u7684\u3002&nbsp;<\/p>\n\n\n\n<p>Thirdly, we have begun work on a UnityScript -&gt; C# automatic conversion tool. There are a few of these out there already, but we weren\u2019t happy with the approaches they use; we already learnt a lot about operating on UnityScript code when we wrote the Script Updater, so we decided just to apply that knowledge and build our own solution. We\u2019ve not yet decided whether this will be integrated directly into Unity or just available as a separate open-source tool, but either way we are expecting to have something available by the time 2017.2 ships later this year. We\u2019ll have a follow-up blog post about this tool when it\u2019s ready.<\/p>\n\n\n\n<p>\u7b2c\u4e09\uff0c\u6211\u4eec\u5df2\u7ecf\u5f00\u59cb\u4f7f\u7528UnityScript-&gt; C\uff03\u81ea\u52a8\u8f6c\u6362\u5de5\u5177\u3002 \u5df2\u7ecf\u6709\u4e00\u4e9b\u8fd9\u6837\u7684\u65b9\u6cd5\u4e86\uff0c\u4f46\u662f\u6211\u4eec\u5bf9\u5b83\u4eec\u4f7f\u7528\u7684\u65b9\u6cd5\u5e76\u4e0d\u6ee1\u610f\u3002 \u5728\u7f16\u5199\u811a\u672c\u66f4\u65b0\u7a0b\u5e8f\u65f6\uff0c\u6211\u4eec\u5df2\u7ecf\u5b66\u5230\u4e86\u5f88\u591a\u6709\u5173\u5728UnityScript\u4ee3\u7801\u4e0a\u8fdb\u884c\u64cd\u4f5c\u7684\u77e5\u8bc6\uff0c\u56e0\u6b64\u6211\u4eec\u51b3\u5b9a\u4ec5\u5e94\u7528\u8fd9\u4e9b\u77e5\u8bc6\u5e76\u6784\u5efa\u81ea\u5df1\u7684\u89e3\u51b3\u65b9\u6848\u3002 \u6211\u4eec\u5c1a\u672a\u51b3\u5b9a\u662f\u5c06\u5176\u76f4\u63a5\u96c6\u6210\u5230Unity\u8fd8\u662f\u4f5c\u4e3a\u5355\u72ec\u7684\u5f00\u6e90\u5de5\u5177\u4f7f\u7528\uff0c\u4f46\u662f\u65e0\u8bba\u54ea\u79cd\u65b9\u5f0f\uff0c\u6211\u4eec\u90fd\u5e0c\u671b\u57282017.2\u5e74\u5e95\u4e4b\u524d\u53ef\u4ee5\u4f7f\u7528\u3002 \u51c6\u5907\u5c31\u7eea\u540e\uff0c\u6211\u4eec\u5c06\u53d1\u5e03\u6709\u5173\u6b64\u5de5\u5177\u7684\u540e\u7eed\u535a\u5ba2\u6587\u7ae0\u3002&nbsp;<\/p>\n\n\n\n<p>After that, we will be watching our Analytics numbers. Our hope is that we\u2019ll see a fairly quick decline in the use of UnityScript \u2013 particularly in the \u201cfewer than 10% of scripts\u201d group, who have less code to migrate \u2013 but if we don\u2019t, we\u2019ll pause our plans and investigate what\u2019s blocking people from migrating. Sometimes it\u2019s just a matter of timing, but other times there are real issues, and we want to make sure we didn\u2019t miss something before we switch it off entirely.<\/p>\n\n\n\n<p>\u4e4b\u540e\uff0c\u6211\u4eec\u5c06\u89c2\u770b\u6211\u4eec\u7684Google Analytics(\u5206\u6790)\u7f16\u53f7\u3002 \u6211\u4eec\u7684\u5e0c\u671b\u662f\uff0c\u6211\u4eec\u4f1a\u770b\u5230UnityScript\u7684\u4f7f\u7528\u51fa\u73b0\u76f8\u5f53\u5feb\u901f\u7684\u4e0b\u964d-\u7279\u522b\u662f\u5728\u201c\u5c11\u4e8e10\uff05\u7684\u811a\u672c\u201d\u7ec4\u4e2d\uff0c\u8fd9\u4e9b\u7ec4\u7684\u4ee3\u7801\u8fc1\u79fb\u8f83\u5c11-\u4f46\u662f\uff0c\u5982\u679c\u4e0d\u8fd9\u6837\u505a\uff0c\u6211\u4eec\u5c06\u6682\u505c\u4f7f\u7528\u8ba1\u5212\u5e76\u8c03\u67e5\u963b\u6b62\u4eba\u4eec\u8fc1\u79fb\u7684\u56e0\u7d20\u3002 \u6709\u65f6\uff0c\u8fd9\u53ea\u662f\u65f6\u95f4\u95ee\u9898\uff0c\u800c\u5176\u4ed6\u65f6\u5019\u5219\u662f\u771f\u6b63\u7684\u95ee\u9898\uff0c\u6211\u4eec\u5e0c\u671b\u786e\u4fdd\u5728\u5b8c\u5168\u5173\u95ed\u4e4b\u524d\u4e0d\u4f1a\u9519\u8fc7\u4efb\u4f55\u5185\u5bb9\u3002&nbsp;<\/p>\n\n\n\n<p>Once we\u2019re content that the usage level is low enough, Unity will no longer ship with the UnityScript compiler, and will no longer recognise .js files as user script code. We\u2019ll also remove the UnityScript examples from the documentation, and remove UnityScript support from the Script Updater.<\/p>\n\n\n\n<p>\u4e00\u65e6\u6ee1\u8db3\u4f7f\u7528\u7387\u8db3\u591f\u4f4e\u7684\u8981\u6c42\uff0cUnity\u5c06\u4e0d\u518d\u968fUnityScript\u7f16\u8bd1\u5668\u4e00\u8d77\u63d0\u4f9b\uff0c\u4e5f\u4e0d\u518d\u5c06.js\u6587\u4ef6\u8bc6\u522b\u4e3a\u7528\u6237\u811a\u672c\u4ee3\u7801\u3002 \u6211\u4eec\u8fd8\u5c06\u4ece\u6587\u6863\u4e2d\u5220\u9664UnityScript\u793a\u4f8b\uff0c\u5e76\u4ece\u811a\u672c\u66f4\u65b0\u5668\u4e2d\u5220\u9664UnityScript\u652f\u6301\u3002&nbsp;<\/p>\n\n\n\n<p>The UnityScript compiler will remain available on Github at&nbsp;<a href=\"https:\/\/github.com\/Unity-Technologies\/unityscript\">https:\/\/github.com\/Unity-Technologies\/unityscript<\/a>&nbsp;in case you need it for anything \u2013 we will not be accepting any pull requests to it, but you can fork it and use it for whatever you need.<\/p>\n\n\n\n<p>\u5982\u679c\u60a8\u9700\u8981\u5b83\uff0c UnityScript\u7f16\u8bd1\u5668\u5c06\u5728Github\u4e0a\u4ecd\u7136\u53ef\u7528\uff0c\u7f51\u5740\u4e3a&nbsp;<a href=\"https:\/\/github.com\/Unity-Technologies\/unityscript\">https:\/\/github.com\/Unity-Technologies\/unityscript-<\/a>&nbsp;\u6211\u4eec\u5c06\u4e0d\u4f1a\u63a5\u53d7\u4efb\u4f55\u5bf9\u5b83\u7684\u62c9\u53d6\u8bf7\u6c42\uff0c\u4f46\u662f\u60a8\u53ef\u4ee5\u5bf9\u5176\u8fdb\u884c\u6d3e\u751f\u5e76\u5c06\u5176\u7528\u4e8e\u65e0\u8bba\u4f60\u9700\u8981\u4ec0\u4e48\u3002&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u5173\u4e8eBoo\u7684\u8bf4\u660e&nbsp;<strong>(<\/strong>A note about Boo<strong>)<\/strong><\/h3>\n\n\n\n<p>We announced back in 2014 that&nbsp;<a href=\"https:\/\/blogs.unity3d.com\/2014\/09\/03\/documentation-unity-scripting-languages-and-you\/\">we were dropping Boo support from the documentation and Editor UI<\/a>. The Boo compiler itself has stuck around, though, because UnityScript is actually a layer on top of Boo \u2013 it uses the Boo runtime libraries, and the UnityScript compiler is written in Boo. This has allowed you to continue using .boo files in your projects, even if there\u2019s nothing in Unity that mentions it any more.<\/p>\n\n\n\n<p>\u6211\u4eec\u57282014\u5e74\u5ba3\u5e03\uff0c&nbsp;<a href=\"https:\/\/blogs.unity3d.com\/2014\/09\/03\/documentation-unity-scripting-languages-and-you\/\">\u6211\u4eec\u5c06\u4ece\u6587\u6863\u548cEditor UI\u4e2d\u5220\u9664Boo\u652f\u6301<\/a>&nbsp;\u3002 \u4f46\u662f\uff0cBoo\u7f16\u8bd1\u5668\u672c\u8eab\u4e00\u76f4\u5b58\u5728\uff0c\u56e0\u4e3aUnityScript\u5b9e\u9645\u4e0a\u662fBoo\u4e4b\u4e0a\u7684\u4e00\u5c42\u2013\u5b83\u4f7f\u7528Boo\u8fd0\u884c\u65f6\u5e93\uff0c\u800cUnityScript\u7f16\u8bd1\u5668\u662f\u7528Boo\u7f16\u5199\u7684\u3002 \u8fd9\u4f7f\u60a8\u53ef\u4ee5\u7ee7\u7eed\u5728\u9879\u76ee\u4e2d\u4f7f\u7528.boo\u6587\u4ef6\uff0c\u5373\u4f7fUnity\u4e2d\u518d\u4e5f\u6ca1\u6709\u63d0\u5230\u5b83\u4e86\u3002&nbsp;<\/p>\n\n\n\n<p>The removal of UnityScript support will also mean the final removal of the Boo compiler. At this point, only 0.2% of projects on 5.6 contain any .boo files, and only 0.006% of projects have more than 3 boo files in. Again: we\u2019re sorry, but its time has come.<\/p>\n\n\n\n<p>\u5220\u9664UnityScript\u652f\u6301\u4e5f\u5c06\u610f\u5473\u7740\u6700\u540e\u5220\u9664Boo\u7f16\u8bd1\u5668\u3002 \u6b64\u65f6\uff0c\u57285.6\u4e0a\u53ea\u67090.2\uff05\u7684\u9879\u76ee\u5305\u542b\u4efb\u4f55.boo\u6587\u4ef6\uff0c\u5e76\u4e14\u53ea\u67090.006\uff05\u7684\u9879\u76ee\u5305\u542b3\u4e2a\u4ee5\u4e0a\u7684boo\u6587\u4ef6\u3002\u518d\u6b21\uff1a\u5f88\u62b1\u6b49\uff0c\u5b83\u7684\u65f6\u673a\u5df2\u7ecf\u5230\u4e86\u3002&nbsp;<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u7ed3\u8bba&nbsp;<strong>(<\/strong>Conclusion<strong>)<\/strong><\/h3>\n\n\n\n<p>We hope this post has explained our reasoning clearly, and given you some reassurance that we are not just doing this without having thought carefully about it.<\/p>\n\n\n\n<p>\u6211\u4eec\u5e0c\u671b\u8fd9\u7bc7\u6587\u7ae0\u6e05\u695a\u5730\u89e3\u91ca\u4e86\u6211\u4eec\u7684\u7406\u7531\uff0c\u5e76\u7ed9\u60a8\u4e00\u5b9a\u7684\u4fdd\u8bc1\uff0c\u6211\u4eec\u4e0d\u4ec5\u4f1a\u4ed4\u7ec6\u8003\u8651\u5b83\uff0c\u800c\u4e14\u8fd8\u4f1a\u8fd9\u6837\u505a\u3002&nbsp;<\/p>\n\n\n\n<p>Going forward, this is the kind of process we want to follow for every situation in which we are removing a feature: announce our intentions, push for change through the Asset Store and Editor UI tweaks, but ultimately make the decision based on actual data about what you\u2019re all doing.<\/p>\n\n\n\n<p>\u5c55\u671b\u672a\u6765\uff0c\u5bf9\u4e8e\u8981\u5220\u9664\u529f\u80fd\u7684\u6bcf\u79cd\u60c5\u51b5\uff0c\u8fd9\u90fd\u662f\u6211\u4eec\u8981\u9075\u5faa\u7684\u4e00\u79cd\u8fc7\u7a0b\uff1a\u5ba3\u5e03\u6211\u4eec\u7684\u610f\u56fe\uff0c\u901a\u8fc7Asset Store\u548cEditor UI\u7684\u8c03\u6574\u6765\u63a8\u52a8\u66f4\u6539\uff0c\u4f46\u6700\u7ec8\u8981\u6839\u636e\u6709\u5173\u4f60\u4eec\u90fd\u5728\u505a\u4ec0\u4e48\u3002&nbsp;<\/p>\n\n\n\n<p>Deprecating and removing features can feel like the opposite of progress sometimes, but it\u2019s an important part of streamlining Unity; like a forest fire clearing the way for new growth, it helps clear the way for us to deliver the fixes and features you want as quickly as possible.<\/p>\n\n\n\n<p>\u6709\u65f6\u8fc7\u65f6\u548c\u8fc7\u65f6\u7684\u529f\u80fd\u611f\u89c9\u5c31\u50cf\u662f\u76f8\u53cd\u7684\u8fdb\u6b65\uff0c\u4f46\u8fd9\u662f\u7b80\u5316Unity\u7684\u91cd\u8981\u7ec4\u6210\u90e8\u5206\u3002 \u5c31\u50cf\u68ee\u6797\u5927\u706b\u4e3a\u65b0\u7684\u589e\u957f\u626b\u6e05\u4e86\u9053\u8def\uff0c\u5b83\u6709\u52a9\u4e8e\u6211\u4eec\u4e3a\u5c3d\u5feb\u63d0\u4f9b\u6240\u9700\u7684\u4fee\u8865\u7a0b\u5e8f\u548c\u529f\u80fd\u626b\u6e05\u9053\u8def\u3002<\/p>\n\n\n\n<p>Unity\u539f\u6587:<a href=\"https:\/\/blogs.unity3d.com\/2017\/08\/11\/unityscripts-long-ride-off-into-the-sunset\/\">https:\/\/blogs.unity3d.com\/2017\/08\/11\/unityscripts-long-ride-off-into-the-sunset\/<\/a><\/p>\n\n\n\n<p>\u672c\u6587\u8f6c\u81ea:https:\/\/blog.csdn.net\/culiao6493\/article\/details\/108642027<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It\u2019s been with us since Unity 1.0, but its time is fina &hellip; <a href=\"https:\/\/1vr.cn\/?p=2385\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">UnityScript\u8e0f\u5165\u5915\u9633\u7684\u6f2b\u6f2b\u957f\u8def<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[25],"tags":[38,209,208],"class_list":["post-2385","post","type-post","status-publish","format-standard","hentry","category-25","tag-unity","tag-unityjs","tag-unityscript","without-featured-image"],"_links":{"self":[{"href":"https:\/\/1vr.cn\/index.php?rest_route=\/wp\/v2\/posts\/2385","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/1vr.cn\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/1vr.cn\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/1vr.cn\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/1vr.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=2385"}],"version-history":[{"count":2,"href":"https:\/\/1vr.cn\/index.php?rest_route=\/wp\/v2\/posts\/2385\/revisions"}],"predecessor-version":[{"id":2387,"href":"https:\/\/1vr.cn\/index.php?rest_route=\/wp\/v2\/posts\/2385\/revisions\/2387"}],"wp:attachment":[{"href":"https:\/\/1vr.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=2385"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/1vr.cn\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=2385"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/1vr.cn\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=2385"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}