class in UnityEditor.PackageManager
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.
CloseFor 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.
CloseIdentifies a specific revision for a Git package using a Git commit hash.
using System; using UnityEngine; using UnityEditor.PackageManager; using UnityEditor.PackageManager.Requests;
[ExecuteInEditMode] public class PackageGitInfoExample : MonoBehaviour { ListRequest m_ListRequest; void Start() { Debug.Log("Listing packages and looking for a git package..."); 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) { if (package.git != null) { Debug.Log($"Git package found: {package.name}"); Debug.Log($"- Repository: {package.repository.url}"); Debug.Log($"- Revision: {package.git.revision}"); Debug.Log($"- Commit Hash: {package.git.hash}"); } } } else { Debug.Log($"Package list request failed: {m_ListRequest.Error}"); } m_ListRequest = null; } } }
Related information