A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://docs.unity3d.com/Manual/../ScriptReference/PackageManager.PackageCollection.html below:

Unity - Scripting API: PackageCollection

PackageCollection

class in UnityEditor.PackageManager

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 Your name Your email Suggestion*

Cancel

Switch to Manual Description

A collection class that represents all packages in a Unity project, providing enumeration and error handling capabilities for package management operations.

Implements IEnumerable <PackageInfo> interface.

The PackageCollection class serves as a container for PackageInfo objects representing all packages in a Unity project. PackageCollection information is typically obtained as the result of a Client.List() operation. Use the PackageCollection to iterate through packages and check for collection-level errors that might occur during package resolution.

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

public class PackageExample { void ListAllPackages() { ListRequest request = Client.List(); while(!request.IsCompleted) {}

if (request.Status == StatusCode.Success) { PackageCollection packages = request.Result; // Check for collection-level errors if (packages.error != null) { Debug.LogError($"Collection error: {packages.error}"); return; }

// Enumerate through packages foreach (PackageInfo package in packages) { Debug.Log($"Found package: {package.name} @ {package.version}"); } } } }

Remarks

Related information

Properties Property Description error The error associated with the package collection.

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4