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; } }