Information about a repository that contains the source code of a package, including the repository type and URL.
using UnityEngine; using UnityEditor.PackageManager; using UnityEditor.PackageManager.Requests;
[ExecuteInEditMode] public class PackageRepositoryInfoExample : MonoBehaviour { ListRequest m_ListRequest; void Start() { Debug.Log("Listing packages and getting their repository 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) { var outputString = $"Dependencies for {package.name}:"; if (package.repository != null) { Debug.Log($"Repository info for {package.name}:" + $"\n- Type: {package.repository.type}" + $"\n- URL: {package.repository.url}" + (string.IsNullOrEmpty(package.repository.revision) ? "" : $"\n- Revision: {package.repository.revision}")); } } } m_ListRequest = null; } } }
Related information