How the heck do you set "componentOrder" ??

Here’s a challenge, subclassing UUI Text,

AddComponentMenu is fine but how the heck do you componentOrder ???

Manual … Unity - Scripting API: AddComponentMenu

thanks!

using UnityEngine;
using UnityEngine.UI;

[AddComponentMenu("UI/Text (Float)")]
[AddComponentMenu.componentOrder = 4] ??!?!??
public class FloatText:Text
    {
    public float _floatText;
    public float floatText
        {
        set
            {
            _floatText = value;
            text = _floatText.ToString("#.00");
            }
        }
    }

You set it in the constructor, see:

[AddComponentMenu("UI/Text (Float)", order:10)]

The constructor’s docs are incorrect as it is missing an overload.

Fascinating - thanks -

(*) indeed that parses, thanks!

(*) it’s weird it is “order” not “componentOrder” like in the doco. if you try “componentOrder” there it does not parse.

(*) interestingly it seems to work in an unusual way …

I had to use a value of "11’ to get this …

thank you! Nice product you have in the asset store, good price too

The constructor arguments to not have to match member names. The constructor argument could be called helloGoodbye and it wouldn’t make a bit of a difference.

Well, idk, count up starting from Selectable.
1 - Selectable
2 - Toggle Group

11 - FloatText

Thanks!