docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    Method SetEditorAsset

    SetEditorAsset(Object)

    Sets the main asset on the AssetReference. Only valid in the editor, this sets both the editorAsset attribute, and the internal asset GUID, which drives the RuntimeKey attribute. If the reference uses a sub object, then it will load the editor asset during edit mode and load the sub object during runtime. For example, if the AssetReference is set to a sprite within a sprite atlas, the editorAsset is the atlas (loaded during edit mode) and the sub object is the sprite (loaded during runtime). If called by AssetReferenceT, will set the editorAsset to the requested object if the object is of type T, and null otherwise.

    Object to reference
    Declaration
    public virtual bool SetEditorAsset(Object value)
    Parameters
    Type Name Description
    Object value
    Returns
    Type Description
    bool
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)