Unity项目初始化出现NullReferenceException错误的原因及解决方法
Unity创建新项目触发NullReferenceException的解决办法
问题现象
每次创建新Unity项目时都会抛出以下空引用异常:
NullReferenceException: Object reference not set to an instance of an object Unity.PlasticSCM.Editor.ProjectDownloader.ParseArguments.GetOrganizationNameFromData (System.String data) (at Library/PackageCache/com.unity.collab-proxy@2.0.3/Editor/PlasticSCM/CloudProjectDownloader/ParseArguments.cs:42) Unity.PlasticSCM.Editor.ProjectDownloader.ParseArguments.CloudOrganization (System.Collections.Generic.Dictionary`2[TKey,TValue] args) (at Library/PackageCache/com.unity.collab-proxy@2.0.3/Editor/PlasticSCM/CloudProjectDownloader/ParseArguments.cs:24) Unity.PlasticSCM.Editor.ProjectDownloader.CloudProjectDownloader.DownloadRepository (System.String unityAccessToken, System.String[] commandLineArgs) (at Library/PackageCache/com.unity.collab-proxy@2.0.3/Editor/PlasticSCM/CloudProjectDownloader/CloudProjectDownloader.cs:63) Unity.PlasticSCM.Editor.ProjectDownloader.CloudProjectDownloader.DownloadRepository (System.String unityAccessToken) (at Library/PackageCache/com.unity.collab-proxy@2.0.3/Editor/PlasticSCM/CloudProjectDownloader/CloudProjectDownloader.cs:51) Unity.PlasticSCM.Editor.ProjectDownloader.CloudProjectDownloader.Execute (System.String unityAccessToken) (at Library/PackageCache/com.unity.collab-proxy@2.0.3/Editor/PlasticSCM/CloudProjectDownloader/CloudProjectDownloader.cs:43) Unity.PlasticSCM.Editor.ProjectDownloader.CloudProjectDownloader.RunOnceWhenAccessTokenIsInitialized () (at Library/PackageCache/com.unity.collab-proxy@2.0.3/Editor/PlasticSCM/CloudProjectDownloader/CloudProjectDownloader.cs:32) UnityEditor.EditorApplication.Internal_CallUpdateFunctions () (at <b55589eb06c2466f99929d8dd849fc32>:0)
解决步骤
禁用Plastic SCM集成
打开Unity Hub → 设置 → 服务,取消勾选"Plastic SCM";或者在Unity编辑器内,依次点击编辑 → 项目设置 → 版本控制,将模式改为"Visible Meta Files"或"Disabled"。更新/重装Collab Proxy包
打开Package Manager(Window → Package Manager),找到"Collab Proxy"(com.unity.collab-proxy),先尝试更新到最新版本;若无效则卸载后重新安装。清理Library文件夹
关闭Unity编辑器,删除项目根目录下的Library文件夹,重新打开项目让Unity自动重建该目录。检查Unity账号登录状态
确保已正常登录Unity账号,无权限异常;可尝试退出账号后重新登录,再创建新项目。切换Unity版本
若当前使用的Unity版本存在兼容问题,尝试升级到最新稳定版,或更换一个已知稳定的版本创建项目。
内容的提问来源于stack exchange,提问作者Huiming
相关产品推荐
相关产品推荐

