当前位置:网站首页>【Unity3D日常BUG】Unity3D解决“找不到类型或命名空间名称“XXX”(您是否缺少using指令或程序集引用?)”等问题
【Unity3D日常BUG】Unity3D解决“找不到类型或命名空间名称“XXX”(您是否缺少using指令或程序集引用?)”等问题
2022-07-23 22:28:00 【恬静的小魔龙】
推荐阅读
大家好,我是佛系工程师*恬静的小魔龙*,不定时更新Unity开发技巧,觉得有用记得一键三连哦。
一、前言
首先,看一下跟我是不是类似的问题:
缺少命名空间引用的问题。
类似的问题有:
The type or namespace name `MySql’ could not be found. Are you missing an assembly referen
The type or namespace name ‘JWT’ could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name ‘Newtonsoft’ could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name ‘****’ could not be found (are you missing a using directive or an assembly reference?)
The type or namespace name ‘BurstCompile’ could not be found (are you missing a using directive or an assembly reference?)
UP是从Visual Studio的NuGet包管理器直接安装的插件集,在Visual Studio是没有报错的,但是在Unity中会报错。
二、原因分析
这个主要原因以下几个方便:
1、Unity的版本问题,老版本无法支持新的依赖库。
2、Unity的目标框架库不支持.Net的框架库
3、Unity中没有加入这个dll
三、解决问题
知道问题了就好解决了。
3-1、Unity版本问题
如果是Unity 的版本问题就升级版本
3-2、Unity不支持目标框架库
如果是Unity的目标框架库不支持.Net的框架库。
在Unity编辑器中,点击File→Build Settings→Player找到Api Compatibility Level:
将.NET Standard 2.0改成.NET 4.x。
安装.NET 4.6框架的,可以改成4.6。
3-3、Unity没有导入dll
有童鞋会说了:我Unity目标框架库、Unity的版本都没有问题,但是还有报错怎么办呢。
那就要根据这个缺少的程序集去找到对应的dll文件,然后放到Unity的Plugins文件夹中:
比如说我缺少JWT和Newtonsoft的程序集,我就找到了对应的dll文件:

放到Unity的Plugins文件夹中:
等到编译完,报错就消失了。
至于dll文件去哪里找。。。说实话我也没有太好的办法,百度。。或者去github找,有更好的方法的同学也可以留言告诉我。
边栏推荐
- 如何彻底强制杀死后台无关进程?
- 疯狂的牛市,下半场何去何从?2021-04-30
- 10 basic written interview questions, how many questions can you answer?
- JS——事件代理和应用场景
- Array -- 209. Subarray with the smallest length
- How about opening an account for Haitong Securities? Is it safe
- 小说里的编程 【连载之十九】元宇宙里月亮弯弯
- synthesizable之Verilog可不可综合
- Is it safe to open a VIP stock account on your mobile phone?
- About synchronizing data from computer to mobile
猜你喜欢

el-select下拉框多选远程搜索反显

海外资深玩家的投资建议(2) 2021-05-03

ADB 命令结合 monkey 的简单使用,超详细

记第一次挖洞交洞历程

MVVM和MVVMLight简介及项目开发(一)

The ultimate experiment of OSPF -- learn the example of OSPF century template

02.网页结构相关知识补充

Tools in the tools package of Damon database (operate Damon database)
The font of Siyuan notes is thinner and lighter than that in other editors (atom, VSC, sublime)

人生总需要一点激情
随机推荐
zk 是如何解决脑裂问题的
experimental design
怎么开户买收益百分之六的理财产品呢?
STM32 MCU uses ADC function to drive finger heartbeat detection module
$, $*, [email protected], $$ Understand the meaning of 0
Interface test
关于电脑端同步到手机端数据
Memory search - DP
Inspiration from Buffett's shareholders' meeting 2021-05-06
[hiflow] Tencent cloud's new generation of automation assistant, which I used to complete the enterprise epidemic prompt (no code)
Taoying collects goods in batches. How to save the babies that have not been uploaded and then import them later
【学习笔记】树的直径,重心
Neo4j应用
10道面试基础笔试题,你能对几题?
Microsoft SQL Server database language and function usage (XIII)
YOLO7 口罩识别实战
Microsoft SQL Server数据库语言及功能使用(十三)
达梦数据库tools包中的工具(操作达梦数据库)
Jmeter性能综合实战——签到及批量签到
el-select下拉框多选远程搜索反显