System.Runtime, Version=6.0.0.0,生成的dll使用出现错误问题

解决:

1.unity左上角file点击选中build settings 点击player settings ,然后在player的window的other settings的configuration更改为 Framerwork

其实这个不换也可以的,我后面调试完,发现这个不是重点,下面第2点才是重点

2.然后vscode创建项目确保为framework

版本默认即可,如果选择standard估计会出错。

3.类库选项生成(对右侧项目名右击属性就可以更改了)

4.然后生成重新生成即可

如果还有问题,可以把.NET版本降低到第七版,第八版不知道,因为我卸载了第八版,也不影响我出问题

我的问题是:

TypeLoadException: Could not load type of field 'RandomCreation.RandomCreationImpl:Random' (1) due to: Could not resolve type with token 01000012 from typeref (expected class 'System.Random' in assembly 'System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a') assembly:System.Runtime, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a type:System.Random member:(null) Rethrow as TypeInitializationException: The type initializer for 'RandomCreation.CreationController' threw an exception. Test.Start () (at Assets/TextC#Script/RandomCreation/Test.cs:24)

非常奇怪的,然而System.Runtime是没有6.0.0.0版本的,那时候我用的是.Net6,才出现Runtime需要6版本,其实我用.Net7,又需要7版本,这是我使用standard时候的问题,后面直接改为framework,重建项目,然后把那些代码转移过来,直接ok了,unity可以顺利调用

希望你们也一样,我其实是第一次做插件。

相关推荐
23957304916 小时前
从 GUI 彻底转向 CLI:我用 .NET + Avalonia + NativeAOT 打造了 Agent 终端托管工具 Octopus
开源·.net·agent·avalonia·ai coding
Jeff-Tsai1 天前
Day 28:DateTime 的时区转换
.net·架构设计·erp·definition-driven
IT规划师1 天前
Redis 核心机制 | Lua 脚本:服务端原子操作·架构决策与生产落地
redis·.net
Jeff-Tsai2 天前
Day 27:Date、DateTime 与 Time 的语义分界
.net·架构设计·erp·definition-driven
sleveen2 天前
新增办理动词只写 Core:SailFlow 动作骨架、同事务信封与 Sync 钩子自锁治理
开源·.net·工作流·oa引擎
Jeff-Tsai3 天前
Day 26:数值语义、多币种与计量单位
.net·架构设计·erp·definition-driven
风云4 天前
两条 Pipe、五个命门:Vane.NET 内核为什么长这样
开源·网络编程·.net·架构设计·vane.net
zdr尽职尽责4 天前
UnityCli 兼容2022版本
ui·unity·ai·c#·游戏引擎
宝桥南山4 天前
Visual Studio 2026新特性 - 可以直接连接DeepSeek(使用Custom Endpoint Provider配置项)
ide·microsoft·微软·aigc·.net·visual studio
Jeff-Tsai4 天前
Day 25:审计轨迹与变更的前后值
.net·架构设计·erp·definition-driven