Skip to content

Reference Content

[ReferenceContent] attribute used for changing content label of reference which used in [DropdownReference].


Support Types

Any references


Parameters

Parameter Name Description
Name Name of reference.
Tooltip Tooltip for reference.

Examples

public abstract class Animal
{
    public abstract void Move(Vector3 direction);
}


public class Leon : Animal
{
    public float valueFloat;

    public override void Move(Vector3 direction)
    {
        // TODO
    }
}


public class Leopard : Animal
{
    public int valueInt;
    public string valueString;

    public override void Move(Vector3 direction)
    {
        // TODO
    }
}


[ReferenceContent("Custom Tiger Label")]
public class Tiger : Animal
{
    public float valueVector3;
    public string valueString;
    public bool valueBool;

    public override void Move(Vector3 direction)
    {
        // TODO
    }
}
Note

Make sure that you have added ApexInspector namespace in your script, to get access to all attributes.

using ApexInspector;


Demo

using ApexInspector;
using UnityEngine;

public class ExampleComponent : MonoBehaviour
{
    [SerializeReference] 
    [DropdownReference]
    public Animal animal;
}

public abstract class Animal
{
    public abstract void Move(Vector3 direction);
}


public class Leon : Animal
{
    public float valueFloat;

    public override void Move(Vector3 direction)
    {
        // TODO
    }
}


public class Leopard : Animal
{
    public int valueInt;
    public string valueString;

    public override void Move(Vector3 direction)
    {
        // TODO
    }
}


[ReferenceContent("Custom Tiger Label")]
public class Tiger : Animal
{
    public float valueVector3;
    public string valueString;
    public bool valueBool;

    public override void Move(Vector3 direction)
    {
        // TODO
    }
}

Live-demo

Live demo