RegistryInfo

class in UnityEditor.PackageManager

Switch to Manual

Description

Contains information about the package registry from which a package was installed, including the registry name and URL.

  • You can get a RegistryInfo instance from the registry property of a PackageInfo object.
  • Each package in your project tracks which registry it came from.
  • Custom scoped registries can be configured in your project settings.
  • The default Unity registry cannot be removed or modified.
using System;
using UnityEngine;
using UnityEditor.PackageManager;
using UnityEditor.PackageManager.Requests;

[ExecuteInEditMode] public class RegistryInfoExample : MonoBehaviour { ListRequest m_ListRequest; void Start() { Debug.Log("Listing packages and getting their registry info..."); m_ListRequest = Client.List(); }

void Update() { if (m_ListRequest != null && m_ListRequest.IsCompleted) { if (m_ListRequest.Status == StatusCode.Success) { foreach (var package in m_ListRequest.Result) { Debug.Log($"Registry info for {package.name}:\n" + $"- Registry name: {package.registry.name}\n" + $"- Registry URL: {package.registry.url}\n" + $"- Is default registry: {package.registry.isDefault}"); } } else { Debug.Log($"Package list request failed: {m_ListRequest.Error}"); } m_ListRequest = null; } } }

Properties

isDefaultWhether this is the default, Unity registry or one of the scoped registries configured in the project manifest.
nameThe registry name.
urlThe registry URL.

Did you find this page useful? Please give it a rating: