Unity项目不能像vs中.csproj一样方便的引用其他类库,必须遵循官方给出的规范才行
官方的教程很繁琐
https://docs.unity3d.com/Manual/CustomPackages.html
其实不用这么繁琐,只需要两个文件即可
package.json和package.asmdef,放置在第三方库的根目录
package.json 结构示例:
{
"name": "person.jianglong.common",
"version": "1.0.0",
"displayName": "Common",
"description": "This packages provides common resources for unity."
}
package.asmdef 结构示例:
{
"name": "person.jianglong.common",
"references": [],
"optionalUnityReferences": [],
"includePlatforms": [],
"excludePlatforms": [],
"allowUnsafeCode": true,
"overrideReferences": false,
"precompiledReferences": [],
"autoReferenced": true,
"defineConstraints": []
}
添加引用
重启下unity,就可以正常引用和查看修改第三方库了
友情提示:估计是用的人不多,毛病很多,遇到引用报错什么的,莫名其妙的毛病时,重启下Unity就好