Unity新建项目时控制台出现NullReferenceException错误求助
解决Unity新项目创建时PlasticSCM空引用错误
错误详情
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 <e3d2e3f6a525465bbf8c67432a3cb6ef>:0)
这个错误是Unity协作代理包(com.unity.collab-proxy)在尝试从Unity Cloud拉取组织信息时,获取到的数据为空引发的空引用异常。当前项目功能虽未受影响,但后续启用云协作、版本控制时可能出现问题。
解决方法
- 清理包缓存:删除项目目录下
Library/PackageCache/com.unity.collab-proxy@2.0.3文件夹,重启Unity后会自动重新下载并初始化该包,修复缓存损坏导致的读取问题。 - 重新认证Unity账号:通过
Edit > Preferences > Account路径注销当前账号,重新登录,确保账号的组织信息能正常同步到本地。 - 禁用自动云协作加载:如果不需要PlasticSCM功能,可在
Edit > Project Settings > Version Control中,将模式设置为Visible Meta Files,并关闭Enable Plastic SCM选项,避免触发相关逻辑。 - 更新协作代理包:打开Package Manager(
Window > Package Manager),找到Unity Collab Proxy,更新到最新版本,旧版本的空引用bug通常会在后续版本中修复。
内容的提问来源于stack exchange,提问作者OJI
相关产品推荐
相关产品推荐

