Version: Unity 6.2 (6000.2)
LanguageEnglish
  • C#

Request<T0>

class in UnityEditor.PackageManager.Requests

/

Inherits from:PackageManager.Requests.Request

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

Description

Tracks the state of an asynchronous Unity Package Manager (Upm) server operation that returns a non-empty response.

A generic base class for Package Manager operations that return a result of type T. This class extends the base Request class to provide type-safe access to operation results.

Notes:

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

[ExecuteInEditMode] public class TypedRequestExample : MonoBehaviour { Request<PackageInfo[]> m_GenericRequest; void Start() { Debug.Log("Searching packages with a typed request..."); m_GenericRequest = Client.Search("com.unity.textmeshpro"); } void Update() { if (m_GenericRequest != null && m_GenericRequest.IsCompleted) { if (m_GenericRequest.Status == StatusCode.Success) { var packages = m_GenericRequest.Result; if (packages.Length > 0) { var package = packages[0]; Debug.Log($"Found package: {package.name}" + $"\nVersion: {package.version}" + $"\nDescription: {package.description}"); } else { Debug.Log("No packages found"); } } else { Debug.LogError($"Search failed: {m_GenericRequest.Error.message}"); } m_GenericRequest = null; } } }

Related information

Properties

Property Description
ResultA property that provides access to the result of a completed Package Manager request operation.

Inherited Members

Properties

PropertyDescription
ErrorThe error returned by the request, if any.
IsCompletedWhether the request is complete.
StatusThe request status.