Struct Sample | Package Manager UI website
docs.unity3d.com
    Show / Hide Table of Contents

    Struct Sample

    Struct for Package Sample

    Inherited Members
    System.ValueType.Equals(System.Object)
    System.ValueType.GetHashCode()
    System.ValueType.ToString()
    System.Object.Equals(System.Object, System.Object)
    System.Object.GetType()
    System.Object.ReferenceEquals(System.Object, System.Object)
    Namespace: UnityEditor.PackageManager.UI
    Syntax
    public struct Sample

    Properties

    description

    Declaration
    public string description { get; }
    Property Value
    Type Description
    System.String

    The description of the package sample

    displayName

    Declaration
    public string displayName { get; }
    Property Value
    Type Description
    System.String

    The display name of the package sample

    importPath

    Declaration
    public string importPath { get; }
    Property Value
    Type Description
    System.String

    The full path to where the sample will be imported, under the project assets folder.

    It is in the form of Project Full Path/Assets/Samples/Package Display Name/Package Version/Sample Display Name/.

    If the sample is an asset package (a .unitypackage file), this value won't be taken into consideration during import

    interactiveImport

    Declaration
    public bool interactiveImport { get; }
    Property Value
    Type Description
    System.Boolean

    Indicates whether to show the import window when importing a sample that is an asset package (a .unitypackage file)

    isImported

    Declaration
    public bool isImported { get; }
    Property Value
    Type Description
    System.Boolean

    Indicates if the sample has already been imported

    resolvedPath

    Declaration
    public string resolvedPath { get; }
    Property Value
    Type Description
    System.String

    The full path to where the sample is on disk, inside the package that contains the sample.

    It is usually in the form of Resolved Full Path to Package/Samples~/Sample Display Name/

    Methods

    FindByPackage(String, String)

    Given a package of a specific version, find a list of samples in that package.

    Declaration
    public static IEnumerable<Sample> FindByPackage(string packageName, string packageVersion)
    Parameters
    Type Name Description
    System.String packageName

    The name of the package

    System.String packageVersion

    The version of the package

    Returns
    Type Description
    IEnumerable<Sample>

    A list of samples in the given package

    Import(Sample.ImportOptions)

    Imports the package sample into the Assets folder.

    Declaration
    public bool Import(Sample.ImportOptions options = Sample.ImportOptions.None)
    Parameters
    Type Name Description
    Sample.ImportOptions options

    Custom import options. See Sample.ImportOptions for more information.

    Note that Sample.ImportOptions are flag attributes, therefore you can set multiple import options using the | operator

    Returns
    Type Description
    System.Boolean

    Returns whether the import is successful

    Back to top
    Copyright © 2023 Unity Technologies — Terms of use
    • Legal
    • Privacy Policy
    • Cookies
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)
    "Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
    Generated by DocFX on 18 October 2023