Unity 从 UnityScript 文件中调用 C# 函数
Unity Calling C# function from UnityScript file
我正在尝试从 UnityScript 运行 C# 中的函数。我的 UnityScript 文件有:
GetComponent("C#File").C#FunctionName();
但在编辑器中它告诉我该函数不是 UnityEngine.Component 的成员。
You need to put the "to be accessed" script in one of the folders thats compiled earlier.
That does not only mean the editor folder, but also Plugins, Standard Assets and Pro Assets
That way scripts of the other languages are able to work with it.
The only alternative is not to access it directly at all and use SendMessage instead
The least amount of trouble and headache is present if you just focus on one language instead of mixing 2+ languages
尝试
GetComponent<"C#File">().C#FunctionName();
我正在尝试从 UnityScript 运行 C# 中的函数。我的 UnityScript 文件有:
GetComponent("C#File").C#FunctionName();
但在编辑器中它告诉我该函数不是 UnityEngine.Component 的成员。
You need to put the "to be accessed" script in one of the folders thats compiled earlier. That does not only mean the editor folder, but also Plugins, Standard Assets and Pro Assets
That way scripts of the other languages are able to work with it.
The only alternative is not to access it directly at all and use SendMessage instead
The least amount of trouble and headache is present if you just focus on one language instead of mixing 2+ languages
尝试
GetComponent<"C#File">().C#FunctionName();