Version: Unity 6.7 Alpha (6000.7)
LanguageEnglish
  • C#

PackageInfo.errors

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Switch to Manual
public Error[] errors;

Description

Errors that the Package Manager reports for this package.

A non-empty array means the package has a problem that can prevent it from resolving. A missing entitlement for a subscription package is one example. This array is empty when the Package Manager finds no problem with the package.

The Package Manager reports every entry in this array with an Error.errorCode of ErrorCode.Unknown. Read Error.message to identify the problem.

These errors describe the package itself. To find out whether the Package Manager operation succeeded, check the Error property of the Request that returned this package information.

using UnityEngine;
using UnityEditor.PackageManager;
using UnityEditor.PackageManager.Requests;

[ExecuteInEditMode] public class PackageInfoErrorsExample : MonoBehaviour { ListRequest m_ListRequest;

void Start() { Debug.Log("Listing packages to check for package errors..."); m_ListRequest = Client.List(); }

void Update() { if (m_ListRequest == null || !m_ListRequest.IsCompleted) return;

if (m_ListRequest.Status == StatusCode.Success) { foreach (var packageInfo in m_ListRequest.Result) { // An empty errors array means the Package Manager found no problem with the package. foreach (var error in packageInfo.errors) { Debug.LogError($"{packageInfo.name} reported an error: {error.message}"); } } } else { // The request itself failed, so no package information is available. Debug.LogError($"Package list request failed: {m_ListRequest.Error.message}"); }

m_ListRequest = null; } }