Class SpriteLibrary | 2D Animation | 3.0.8
docs.unity3d.com
    Show / Hide Table of Contents

    Class SpriteLibrary

    Component that holds a Sprite Library Asset. The component is used by SpriteResolver Component to query for Sprite based on Category and Index

    Inheritance
    Object
    SpriteLibrary
    Namespace: UnityEngine.Experimental.U2D.Animation
    Syntax
    public class SpriteLibrary : MonoBehaviour

    Properties

    spriteLibraryAsset

    Get or Set the current SpriteLibraryAsset to use

    Declaration
    public SpriteLibraryAsset spriteLibraryAsset { get; set; }
    Property Value
    Type Description
    SpriteLibraryAsset

    Methods

    AddOverride(Sprite, String, String)

    Add or replace an override when querying for the given Category and Label.

    Declaration
    public void AddOverride(Sprite sprite, string category, string label)
    Parameters
    Type Name Description
    Sprite sprite

    Sprite to override to

    String category

    Category name to override

    String label

    Label name to override

    AddOverride(SpriteLibraryAsset, String)

    Add or replace an override when querying for the given Category. All the categories in the Category will be added.

    Declaration
    public void AddOverride(SpriteLibraryAsset spriteLib, string category)
    Parameters
    Type Name Description
    SpriteLibraryAsset spriteLib

    Sprite Library Asset to query

    String category

    Category name from the Sprite Library Asset to add override

    AddOverride(SpriteLibraryAsset, String, String)

    Add or replace an override when querying for the given Category and Label from a SpriteLibraryAsset

    Declaration
    public void AddOverride(SpriteLibraryAsset spriteLib, string category, string label)
    Parameters
    Type Name Description
    SpriteLibraryAsset spriteLib

    Sprite Library Asset to query

    String category

    Category name from the Sprite Library Asset to add override

    String label

    Label name to add override

    GetSprite(String, String)

    Return the Sprite that is registered for the given Category and Label for the SpriteLibrary

    Declaration
    public Sprite GetSprite(string category, string label)
    Parameters
    Type Name Description
    String category

    Category name

    String label

    Label name

    Returns
    Type Description
    Sprite

    Sprite associated to the name and index

    HasOverride(String, String)

    Method to check if a Category and Label pair has an override

    Declaration
    public bool HasOverride(string category, string label)
    Parameters
    Type Name Description
    String category

    Category name

    String label

    Label name

    Returns
    Type Description
    Boolean

    True if override exist, false otherwise

    RefreshSpriteResolvers()

    Request SpriteResolver components that are in the same hierarchy to refresh

    Declaration
    public void RefreshSpriteResolvers()

    RemoveOverride(String)

    Remove all Sprite Library override for a given category

    Declaration
    public void RemoveOverride(string category)
    Parameters
    Type Name Description
    String category

    Category overrides to remove

    RemoveOverride(String, String)

    Remove Sprite Library override for a given category and label

    Declaration
    public void RemoveOverride(string category, string label)
    Parameters
    Type Name Description
    String category

    Category to remove

    String label

    Label to remove

    In This Article
    • Properties
      • spriteLibraryAsset
    • Methods
      • AddOverride(Sprite, String, String)
      • AddOverride(SpriteLibraryAsset, String)
      • AddOverride(SpriteLibraryAsset, String, String)
      • GetSprite(String, String)
      • HasOverride(String, String)
      • RefreshSpriteResolvers()
      • RemoveOverride(String)
      • RemoveOverride(String, String)
    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