SaintsField icon indicating copy to clipboard operation
SaintsField copied to clipboard

is there an attrib that changes the name of element into a chosen field?

Open laurentopia opened this issue 1 year ago • 1 comments

For example this: image where elements 0 is replaced by "Acknowledge" as if I were to use a string instead of enum. I tried this workaround but it won't fool Unity :D image

laurentopia avatar Aug 19 '24 00:08 laurentopia

Yes

[Serializable]
public enum ANIMSTATE
{
    None,
    State,
    AnotherState,
}

[Serializable]
public struct AudioStateClips
{
    public ANIMSTATE state;
}

[RichLabel(nameof(LabelAudioStateClips), true)]
public AudioStateClips[] audioClips;

public string LabelAudioStateClips(AudioStateClips clip, int index)
{
    return $"{clip.state} ({index})";
}

image

TylerTemp avatar Aug 19 '24 01:08 TylerTemp

wow nice! thanks!

laurentopia avatar Aug 19 '24 21:08 laurentopia