如何为 Unity 2019 添加 JavaScript 支持? [英] How to add JavaScript support to Unity 2019?

查看:43
本文介绍了如何为 Unity 2019 添加 JavaScript 支持?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我多年前开发了一款游戏,现在决定改进游戏并再次开始下载统一版.升级 Unity 后,我发现 Unity 并不知道所有 JS 文件,并且已将它们与对象分离.有什么解决方案可以解决问题并再次为 Unity 添加 JS 支持?

I developed a game years ago and now decided to improve the game and started to download the unity again. after upgrading Unity I figured out Unity doesn't know all JS files and has detached them from objects. any solution that fixes the problem and adds JS support to Unity again?

推荐答案

  1. 2017 年 8 月

从 Unity 1.0 开始,Unity 游戏引擎就支持了一个名为 UnityScript 的 JavaScript 版本.今天在 Unity 博客上,Unity 宣布他们将不再支持 UnityScript.从 Unity 2017 beta 2 开始,他们将删除直接在编辑器中创建 JavaScript 文件的功能.然后他们将取消将 .js 文件提交到 Asset Store 的功能.然后在未来的某个时候,他们将完全删除编译器,尽管它可以在 Github 上分叉.根据 Unity 的分析数据,目前只有很小一部分社区甚至在使用 UnityScript,不到 4% 的人将其用作主要语言.

All the way back to Unity 1.0, the Unity game engine has supported a version of JavaScript called UnityScript. Today on the Unity blog, Unity have announced that they will no longer be supporting UnityScript going forward. Starting in Unity 2017 beta 2, they will remove the ability to create JavaScript files directly inside the editor. Then they will be removing the ability to submit .js files to the Asset Store. Then at some point in the future they will be removing the compiler completely, although it will be available to be forked on Github. According to Unity analytics numbers on a very small portion of the community is even using UnityScript at this point, with under 4% using it as the primary language.

他们实际上发布了一些关于语言使用的相当有趣的统计数据:

They actually published some fairly interesting stats about language usage:

迄今为止,在所有使用 Unity 5.6 的项目中,大约 14.6% 的项目至少包含一个扩展名为 .js 的文件.14.6% 听起来相当高,但随后我们进一步细分了数字,并查看了 .js 文件占项目 (.js + .cs) 总脚本文件的比例.因此,剩下 85.4% 的项目完全使用 C#,根本没有 UnityScript 文件.9.5% 的项目大多使用 C#——它们有一些 UnityScript 文件,但不到其总脚本文件数的 10%.另外 1.5% 的项目有 10% 到 20% 的代码在 UnityScript 文件中.剩下 3.6% 的项目的 20% 以上的代码是在 UnityScript 中的.只有 0.8% 的项目完全(即 100%)在 UnityScript 中.

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). So, that leaves 85.4% of all projects which are entirely in C#, with no UnityScript files at all. 9.5% of all projects are mostly in C# – 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. That leaves 3.6% of all projects that have more than 20% of their code in UnityScript. Only 0.8% of all projects are exclusively (i.e. 100%) in UnityScript.

社区中只有一小部分人使用 UnityScript,继续支持它没有多大意义,尤其是现在 C# 支持不再停留在石器时代.

With only a small portion of the community using UnityScript it does make very little sense to continue supporting it, especially now that C# support isn’t stuck in the stone ages.

这篇关于如何为 Unity 2019 添加 JavaScript 支持?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆