0

错误:

IL2CPP error for type 'Namespace.SubNamespace.MyClass/<MyIEnumeratorFunc>d__20' in assembly 'Path\MyUnityProject\Temp\StagingArea\Data\Managed\VisualStudioSolutionName.dll'
Additional information: Interface System.Collections.Generic.IEnumerator`1<System.Object> method T System.Collections.Generic.IEnumerator`1<System.Object>::get_Current() not implemented on non-abstract class Namespace.SubNamespace.MyClass/<MyIEnumeratorFunc>d__20

Unity 期望 System.Collections.IEnumerator 并且我尝试使用 IEnumerator:

  1. 我试着直接写

    private System.Collections.IEnumerator MyIEnumeratorFunc(){}
    
  2. 我试图删除

    using System.Collections.Generics;
    

    并将其附加到每个列表/字典条目 一切都在编辑器中工作,但我收到上面描述的错误:似乎它试图使用 System.Collections.GENERICS.IEnumerator。

此外,如果我使用源代码(不是 .dll),错误就会消失

此外,您可以通过使用任何 IEnumerator/async 函数(甚至是空的)创建 .dll 来重现它并为 iOS 构建。

4

1 回答 1

0

问题出在项目名称中。解决方案是

  1. 在解决方案资源管理器中右键单击项目名称(不是解决方案名称)。

  2. 特性

  3. “应用程序”选项卡

  4. 程序集名称 -> 设置为与 .dll 文件名相同(不带“.dll”)

于 2019-05-15T16:24:06.940 回答