I was surprised that BehaviorDesigner.Runtime.ObjectDrawers is almost empty and there's only the float and int sliders and nothing else.
One of the basic things I use often is a header to separate variables once I have more than a few. One of the most basic of things and I'm wondering why it isn't found in the namespace above. This means I set out to make it with my limited drawers knowledge:
Then in use:
Sadly this code shows a label but hides the actual variable, which is of course not what I intended.
How do I make this simple thing work?
One of the basic things I use often is a header to separate variables once I have more than a few. One of the most basic of things and I'm wondering why it isn't found in the namespace above. This means I set out to make it with my limited drawers knowledge:
Code:
public class VarHeaderAttribute : ObjectDrawerAttribute
{
public string desc;
public VarHeaderAttribute(string desc)
{
this.desc = desc;
}
}
[CustomObjectDrawer(typeof(VarHeaderAttribute))]
public class VarHeaderDrawer : ObjectDrawer
{
public override void OnGUI(GUIContent label)
{
base.OnGUI(label);
VarHeaderAttribute header = attribute as VarHeaderAttribute;
EditorGUILayout.LabelField(header.desc, EditorStyles.boldLabel);
}
}
Then in use:
Code:
[VarHeader("Movement")]
[SerializeField]
private FloatReference _distToTarget;
[SerializeField]
private FloatReference _moveSpeed;
[SerializeField]
private FloatReference _rotSpeed;
Sadly this code shows a label but hides the actual variable, which is of course not what I intended.
How do I make this simple thing work?