且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何在Boo中使用UnityScript中的变量?

更新时间:2023-11-25 08:03:46

这里的问题是编译顺序.在您的Boo和JS代码被编译时,它们无法相互访问.但是有一种解决方法.

The problem here is compilation order. At the time where your Boo and JS code are compiled, they don't have access to each other. But there is a workaround for that.

插件代码将在常规"代码之前编译在您的资产中.因此,如果您的Boo代码依赖于JS(UnityScript)代码中的某些内容,则可以将JS代码放入名为插件"的文件夹中.请记住,这(在逻辑上)只能以一种方式起作用.因此,如果您的JS代码曾经依赖于Boo方面的内容,那么您就不走运了.

Plugin code will be compiled before the "regular" code in your assets. So if your Boo code relies on something in your JS (UnityScript) code, you can put the JS code inside a folder named "Plugins". Keep in mind that this (logically) works only one way around though. So if your JS code ever relies on something in the Boo side, you're out of luck.

但是,这确实(如果是您自己的代码)通常暗示着切换到一种语言并坚持使用是一个好主意.并且,由于重点更多地放在C#上,而不是UnityScript上,尤其是Boo上,您可能需要考虑迁移.

This does however (if it is your own code) usually imply it's a good idea to switch to a single language and stick to it. And with focus being more on C# than on UnityScript and particularly Boo, you might want to consider moving over.