问题标签 [il2cpp]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
201 浏览

c# - Unity and Hololens: Reading non-text file exception

[Edited] First I have to apologize, I've just noticed the bit of code I pasted as our code for reading png files is not working in .net backend either (the txt reading does work for both, .net and il2cpp, as stated). The call stack cames from a different exception. Is corrected now

We are working in a XR application for Microsoft Hololens which involves reading both, txt and binary files (the latter as byte arrays to be loaded as Unity textures by Texture2D.LoadImage). As we need to provide an easy way for the user to change/modify the files both are located in the 3D Objects folder in the hololens.

Everything was working properly until we recently had to change our scripting backend from .net to il2cpp; since then we are finding errors whenever we try to read our png files though txt can still be readed with no changes in our .net source code.

We are reading our text files like this (working properly):

For the PNGs we tried several different approachs, form the simplest File.ReadAllBytes( pngFile.Path); (it works for .net but not for il2cpp), FileStream and other methods but they always fail at some point. The last one is this:

... which throws this exception:

Exception thrown: 'System.NullReferenceException' in Assembly-CSharp.dll

and have only this in the call stack:

at CsvReader.d__4.MoveNext()

So it seems to us that our dataReader stays null but we don't really understand what is happening neither how to prevent it. Can anyone provide some advice or ideas for reading such kind of file?

regards!

0 投票
1 回答
316 浏览

c# - Hololens 中的 DLL 与 IL2CPP 后端冲突

我一直在 Hololens 上进行开发。该项目位于 .NET 4.x 上,带有 IL2CPP 和 API 兼容性 4.x。我正在使用 Unity 2018.3.6f。

我需要添加外部 DLL (IdentityClient.dll)

参考:IdentityModel NuGet 包

此 dll 依赖于 Newtonsoft.Json 和 System.Text.Encodings.Web。

经过大量工作,我现在可以使用 dll 部署我的应用程序,但是当我使用它们时,它会使我的应用程序崩溃。问题在于 Newtonsoft.Json。

由于 IL2CPP 使用 AOT 编译和 newtonsoft 使用反射,它会崩溃。我已经用这个 https://assetstore.unity.com/packages/tools/input-management/json-net-for-unity-11347替换了 Newtonsoft.Json.dll

我已经能够在我的代码中使用 Newtonsoft,但 IdentityModel.dll 仍然引用旧的实现,即使我删除了它。所以它又崩溃了。我现在有点卡住了,我想知道你们中是否有人有解决方案!

我也在想如果我也不能解决它:

  1. fork IdentityModel的github项目并进行调整
  2. 只需手动制作所有内容,而不是在 IdentityModel 上中继,但这可能需要一些时间。

此外,在 Unity 编辑器中一切正常,但在部署时会崩溃。

0 投票
1 回答
39 浏览

unity3d - 为什么它用不同的类型编译?

错误:

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

  1. 我试着直接写

    /li>
  2. 我试图删除

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

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

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

0 投票
1 回答
3265 浏览

c# - 在 iOS 上通过 C# IL2CPP 中的反射调用泛型方法

这个问题专门针对 Unity3d IL2CPP 和 iOS。

使用反射调用泛型方法

在 Mac 上的 Unity 编辑器中运行时,这可以按预期工作。在 iOS 上调用失败并出现错误:

仅仅是 AOT 系统不能调用泛型方法还是我遗漏了什么?

0 投票
1 回答
478 浏览

c# - 使用 IL2CPP 对 lib 类进行 XML 序列化有什么问题?

在 Unity 项目上将脚本后端从 Mono 设置为 IL2CPP 后,当它运行 lib 类的 XML 反序列化(来自 dll 库)时,它会在运行时引发异常。

Google Play 很快将不再接受不包含 64 位版本的构建。这意味着在 Unity 中我们必须从 Mono 切换到 IL2CPP。目标设备是 Android 设备。

我们尝试使用各种版本的 .Net Framework 构建 dll 库。我们还尝试在默认构造函数(无参数)中添加一些指令。然后我们在反序列化调用之前使用构造函数,以防在构建时进行剥离。我们试图通过代码强制禁用剥离级别,但我们不知道它是否有效。

这是发生问题的类,其中反序列化失败。

那是我的序列化功能

一切都适用于 Mono,但使用 IL2CPP,它会引发以下错误 =>“System.InvalidOperationException:存在反映类型'Api.Common.Licence.DeviceLicenceFile'的错误。---> System.InvalidOperationException:Api.Common.Licence。 DeviceLicenceFile 无法序列化,因为它没有默认的公共构造函数”当然,我们有一个无参数的构造函数。

编辑:我们在 Unity 2018.4

0 投票
0 回答
541 浏览

c# - Unity il2cpp 代码剥离改变了我的应用行为

在 Unity 中,当我使用单声道和禁用代码剥离进行构建时,我的应用程序运行良好。

但是我不能用单声道获得 ARM64,所以我必须使用 il2cpp。

使用 il2cpp 代码剥离始终处于启用状态,它会改变我的游戏行为。它可能会删除重要的代码。

谷歌播放要求 arm64,如果我使用单声道,那将是不可能的。使用 il2cpp 我的应用程序无法按我的意愿运行。

有很多代码,所以我不能在这里发布它们,但是你知道代码剥离会删除什么样的代码。

我能做些什么?

0 投票
1 回答
714 浏览

c# - UWP 的 Unity:指定了无效的句柄

我使用 Il2Cpp 为 UWP 构建了我的游戏。当它尝试连接到互联网时,我收到此错误:

在 game.exe 中的 0x2121FE8A 处引发异常:0xC0000008:指定了无效句柄。

由于 C# 源代码变成了 C++ 项目,我不知道的代码有什么问题。当我在 Unity 中玩游戏时,它可以正常工作。

我怎样才能找到问题所在的线索?

截屏:

在此处输入图像描述

0 投票
0 回答
210 浏览

unity3d - 使用 IL2CPP 构建错误:“System.ComponentModel.Win32Exception:指定的可执行文件不是此 OS 平台的有效应用程序。”

在将脚本后端从 Mono 更改为 IL2CPP 以支持 Android x64 时,我遇到了一些麻烦,因为 Google 表示这是必要的。

我试图在整个互联网上搜索修复,但找不到任何东西。

错误:il2cpp.exe 没有捕获异常:System.AggregateException:发生了一个或多个错误。---> System.ComponentModel.Win32Exception:指定的可执行文件不是此操作系统平台的有效应用程序。

0 投票
0 回答
535 浏览

unity3d - 这是什么统一错误?Addr2Line 故障

突然我有这个错误,我不知道如何解决。

  1. 我在电脑上有这个错误

/.................................................. ......... Addr2Line 故障

脚本后端:il2cpp

构建类型:发布

CPU:arm64-v8a


Addr2Line 故障

脚本后端:il2cpp

构建类型:发布

CPU:arm64-v8a

C:/Program Files/Android/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-addr2line.exe -C -f -p -e C :\ program Files \ Unity \ hub \ editor \ 2019.1.0f2 \ editor \ data \ plaphbackEngines \ androidplayer \ variations \ variations \ il2cpp \ repares \ symbors \ arm64-v8a \ libunity \ libunity.so \ libunity.so 000000000000000000000000000000000000000000000000来00000000.00.0000000000来州000000000000000000000000000000000000000000000000000000000000来零000000000000000000000000000000000000来00000000..00.800车0000000000000000000000000000000000000000000000000000000000000000000000000000000000来00000000.00..800开间

标准错误 [C:/Program Files/Android/android-ndk-r16b/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-addr2line.exe: 'C:\Program' :没有这样的文件]标准输出[

]退出代码:1

/.................................................. …………

  1. 构建android应用程序后出现此错误。

错误:当前不可用 il2cpp 行:-1

0 投票
2 回答
8114 浏览

android - 构建 - il2cpp 没有正常运行

我正在使用 unity 2019.2.0f1 和 unity 推荐的集成 jdk-sdk 和 ndk 来为 android 平台构建游戏首先我使用 Mono 成功构建了我的项目之后我尝试使用 IL2CPP 构建不幸的是我无法构建我的游戏并在控制台中得到这些错误