Version: Unity 6.2 Alpha (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

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

Inherited Members

Properties

ErrorThe error returned by the request, if any.
IsCompletedWhether the request is complete.
StatusThe request status.
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961