使用Unity使用什么语言进行开发

发布于 2024-10-17 06:48:46 字数 184 浏览 3 评论 0原文

使用 Unity 进行编程时需要使用什么语言?或者它是多种语言的API?

我通读了文档,我想我错过了所使用的语言的要点。

它说它有 iOS 部署,这仍然允许程序员使用 Objective C 进行编码吗?

Unity 是一个可用于多种平台的 sdk 吗?它是如何工作的?它提到在多个平台上部署相同的代码。

What language does one need to use when programming with Unity? Or is it an API for many languages?

I read through the docs and I guess I missed the point on the language used.

It says it has iOS deployment, would this still allow the programmer to code in objective C?

Is Unity an sdk which can be used for many platforms or how does it work? It mentions deploy the same code on multiple platforms.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(12

半世蒼涼 2024-10-24 06:48:46

所有开发都是使用您选择的 C#、Boo 或 JavaScript 方言完成的。

  • C# 无需解释:)
  • Boo 是一种 CLI 语言,其语法与 Python 非常相似;然而,它是静态类型的并且有一些其他差异。它不是“真正的”Python;而是“真正的”Python。只是看起来很相似。
  • Unity使用的JavaScript版本也是CLI语言,并且是编译的。新手常常认为 JS 不如其他三种,但它是经过编译的,并且同样快速且功能齐全。

文档中的大部分示例代码都是用 JavaScript 编写的;如果你浏览一下官方论坛和 wiki,你会发现 C# 和 Javascript 的混合相当均匀。似乎很少有人使用 Boo,但它同样好;选择您已经了解或最快乐学习的语言。

Unity 获取您的 C#/JS/Boo 代码并将其编译为在 iOS、Android、PC、Mac、XBox、PS3、Wii 或 Web 插件上运行。取决于最终可能是 Objective C 或其他平台的平台,但这对您来说是完全透明的。了解 Objective C 确实没有什么好处;你不能在里面编程。


更新 2019/31/01

从 Unity 2017.2 开始,“UnityScript”(Unity 的 JavaScript 版本,但并不完全相同)通过删除添加“JavaScript”文件的选项,迈出了完全弃用的第一步用户界面。虽然仍然可以使用 JS 文件,但在以后的版本中将完全删除对它的支持。

这也意味着 Boo 将变得无法使用,因为它的编译器实际上是作为 UnityScript 之上的一层构建的,因此也将被删除。

这意味着将来只有 C# 拥有本机支持。

unity 发布了 关于 2017 年 8 月弃用 UnityScript 和 Boo 的完整文章

All development is done using your choice of C#, Boo, or a dialect of JavaScript.

  • C# needs no explanation :)
  • Boo is a CLI language with very similar syntax to Python; it is, however, statically typed and has a few other differences. It's not "really" Python; it just looks similar.
  • The version of JavaScript used by Unity is also a CLI language, and is compiled. Newcomers often assume JS isn't as good as the other three, but it's compiled and just as fast and functional.

Most of the example code in the documentation is in JavaScript; if you poke around the official forums and wiki you'll see a pretty even mix of C# and Javascript. Very few people seem to use Boo, but it's just as good; pick the language you already know or are the happiest learning.

Unity takes your C#/JS/Boo code and compiles it to run on iOS, Android, PC, Mac, XBox, PS3, Wii, or web plugin. Depending on the platform that might end up being Objective C or something else, but that's completely transparent to you. There's really no benefit to knowing Objective C; you can't program in it.


Update 2019/31/01

Starting from Unity 2017.2 "UnityScript" (Unity's version of JavaScript, but not identical to) took its first step towards complete deprecation by removing the option to add a "JavaScript" file from the UI. Though JS files could still be used, support for it will completely be dropped in later versions.

This also means that Boo will become unusable as its compiler is actually built as a layer on top of UnityScript and will thus be removed as well.

This means that in the future only C# will have native support.

unity has released a full article on the deprecation of UnityScript and Boo back in August 2017.

裂开嘴轻声笑有多痛 2024-10-24 06:48:46

据我所知,你可以使用c#。

也可以使用晦涩的语言“Boo”。 (位于 https://boo-language.github.io/

过去(大约之前 ) 2012)可以使用 Java 的一个奇怪的变体,但现在已被弃用并且不起作用。

请注意,Unity 可以构建 Android / iOS 和许多其他平台。事实上,iOS 编程使用 Objective-C 或 Swift,与 Unity3D 级别完全无关。 Unity 使用 C# 进行编程。

As far as I know, you can go with c#.

You can also use the obscure language "Boo". (Found at https://boo-language.github.io/)

In the past (before about 2012) it was possible to use a strange variant of Java but that is now deprecated and does not work.

Note that Unity builds to Android / iOS, and many other platforms. The fact that iOS programming uses objective-c or Swift, is, completely irrelevant at the Unity3D level. Unity is programmed using c#.

面犯桃花 2024-10-24 06:48:46

当您在 Unity 中为 iPhone 进行构建时,它会将您的单声道程序集(用 C# 或 JavaScript 编写)提前 (AOT) 编译为本机 ARM 代码。

该创作工具还创建一个存根 xcode 项目和编译 lib 的引用。如果您想要执行的本机操作尚未在 Unity 环境中公开(例如访问指南针和/或陀螺仪),您可以将目标 C 代码添加到此 xcode 项目中。

When you build for iPhone in Unity it does Ahead of Time (AOT) compilation of your mono assembly (written in C# or JavaScript) to native ARM code.

The authoring tool also creates a stub xcode project and references that compiled lib. You can add objective C code to this xcode project if there is native stuff you want to do that isn't exposed in Unity's environment yet (e.g. accessing the compass and/or gyroscope).

窝囊感情。 2024-10-24 06:48:46

Unity3d 支持 C#、Boo 和 JavaScript。
该框架将其转换为中间格式,然后转换为所需的平台(IOS/Android/Linux/Windows)

请记住,首先编译 C# 脚本,然后是 JS 和 Boo
因此,如果您希望 C# 脚本与 JS 交互,则必须将 JS 保留在 Standard Assets 文件夹中。

Unity3d supports C#, Boo and JavaScript.
The framework translates this into its intermediate format and later to the desired platform (IOS/Android/Linux/Windows)

Keep in mind, C# Scripts are compiled first, followed by JS and Boo
Hence if you want a C# script to interact with a JS, you ll have to keep the JS in the Standard Assets Folder.

岁月如刀 2024-10-24 06:48:46

Unity 支持:
1. UnityScript(称为Javascript,但包含更多Unity游戏引擎的功能。我认为这很容易学习)
2.嘘(无经验)
3. C#(我更喜欢这个,因为它学习起来很有用,而且你也可以在 Unity 之外使用它。我也认为它很容易习惯)

Unity supports:
1. UnityScript(Is known as Javascript but includes more functionality for the Unity game engine. I think this could be very easy to learn)
2. Boo (No experience)
3. C# (I prefer this as it is useful to learn and you will be able to use this outside of unity as well. I also think it is easy to get used to)

梦屿孤独相伴 2024-10-24 06:48:46

目前,只有 C# 可以用于 Boo 的脚本支持,而 Javascript 已被删除。

right now only C# can be used for scripting support for Boo and Javascript was removed.

早茶月光 2024-10-24 06:48:46

Unity 中 C# 和 Javascript 脚本语法之间的一些核心差异。

http://unity3d.com/learn/tutorials /modules/beginner/scripting/c-sharp-vs-javascript-syntax

但请记住,C# 是统一开发的最佳选择

Some of the core differences between C# and Javascript script syntax in Unity.

http://unity3d.com/learn/tutorials/modules/beginner/scripting/c-sharp-vs-javascript-syntax

but keep in mind C# is the best one to develop in unity

吃兔兔 2024-10-24 06:48:46

您可以使用 C#、Javascript、Boo。

除非您编写的函数的计算要求导致处理器负载过重,否则 Javascript 在大多数情况下都能提供足够好的性能。

You can use C#, Javascript, Boo.

Unless computing requirement for the function you write cause heavy load on processor, Javascript gives good enough performance for most cases.

注定孤独终老 2024-10-24 06:48:46

它使用c#,和unityscript(javascript),由c++源代码支持,以及c++插件支持(源代码和插件需要pro)。

unity3d 脚本参考非常容易理解/使用(如果需要的话),可能是cryengine、udk 等引擎中最简单的。

希望这会有所帮助。

It uses c#, and unityscript(javascript), which is supported by the source code in c++, and c++ plugin support(source code, and plugins require pro).

The unity3d script reference is really easy to understand/use if needed, probably the easiest out of engines like cryengine, udk, etc.

Hope this helps.

彻夜缠绵 2024-10-24 06:48:46

可以使用以下三种脚本语言中的任何一种:

  1. JavaScript
  2. C#
  3. Boo

但我个人选择 C#,因为我发现它比其他两种更快。

One can use any one of the following three scripting languages:

  1. JavaScript
  2. C#
  3. Boo

But my personal choice is C# because I find it faster in comparison to other two.

白日梦 2024-10-24 06:48:46

我记得这一点是在互联网上阅读一些有关 Unity 性能的文章时发现的,这些文章警告 JavaScript 用户不要在 Unity 中使用 JavaScript,因为在 Unity 中使用 JavaScript 而不是 C# 会产生巨大的问题,它说 C# 几乎比 JavaScript 快 4 倍! 。

我真的很欣赏这篇文章,因为它在我即将开始游戏时救了我,我并不是说 JavaScript 对 Unity 开发人员不利,它很好,但我的建议可能是,如果你喜欢使用 JavaScript,你应该将它用于简单的小游戏不适合大项目,因为它确实可能是一个大问题!

I remember this from reading some articles about performance in Unity from internet which was warning JavaScript users from using it in Unity about really massive issues of using JavaScript in unity instead of C#, it says that C# is almost 4x faster than JavaScript!.

I really appreciate that article because it saved me when I was about to start gaming, I don't mean that JavaScript is bad for unity developers , it is good but my advice could be that if you like using JavaScript, you should use it for simple small games NOT FOR BIG PROJECTS because it really can be a big problem!

心不设防 2024-10-24 06:48:46

据我所知,C#是Unity开发中最常见的,它可以让你轻松地制作不同的功能和命令。

UnityScript 与 Javascript 类似,Superpig 已将其删除:

我们希望在某个时候摆脱 UnityScript。

然而,UnityScript 并不是一个好的选择,因为它只是一种使用 javascript 语法和 C# 格式的语言,这使得它很奇怪,并不是游戏开发的最佳选择。

此外,其他.NET语言也可以与Unity一起使用,如果它们可以编译兼容的DLL也可以。参见此链接

As I know,C# is the most common in Unity development,it allows you do make different functions and commands easily.

UnityScript,just similar to Javascript,is being removed by the unity according to this by Superpig:

we are looking to get rid of UnityScript at some point.

However,UnityScript is not a good choice because it's just a langauge that uses javascript syntax with C# format,that make it strange and is not the best choice for game development.

Besides,other .NET languages can be used with Unity if they can compile a compatible DLL is also OK.See this link.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文