AuthorInfo

class in UnityEditor.PackageManager

Switch to Manual

Description

Contains information about the author of a package, including their name, email, and URL.

Notes: * Author information is included in the package's `package.json` file. * Email and URL are optional fields and might be null. * A package can have only one author, therefore, use contributors for additional credits.

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

[ExecuteInEditMode] public class PackageAuthorInfoExample : MonoBehaviour { ListRequest m_ListRequest; void Start() { Debug.Log("Listing packages and getting their author 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) { if (package.author != null && (!string.IsNullOrWhiteSpace(package.author.name) || !string.IsNullOrWhiteSpace(package.author.email) || !string.IsNullOrWhiteSpace(package.author.url) ) ) { Debug.Log($"Package: {package.name}"); Debug.Log($"- Author: {package.author.name}"); if (!string.IsNullOrEmpty(package.author.email)) Debug.Log($"- Email: {package.author.email}"); if (!string.IsNullOrEmpty(package.author.url)) Debug.Log($"- Website: {package.author.url}"); } } } else { Debug.Log($"Package list request failed: {m_ListRequest.Error}"); } m_ListRequest = null; } } }

Properties

emailThe email address of the author (optional).
nameThe name of the author.
urlThe url address of the author (optional).

Did you find this page useful? Please give it a rating: