NaughtyAttributes icon indicating copy to clipboard operation
NaughtyAttributes copied to clipboard

[Issue] BoxGroup, Button, ReorderableList, ShowNativeProperty and ShowNonSerializedField attributes cannot be nested inside serializable structs/classes

Open dbrizov opened this issue 5 years ago • 7 comments

dbrizov avatar Jan 20 '20 09:01 dbrizov

Are these all in the update plan in the future?

MingFengShang avatar Jan 20 '20 09:01 MingFengShang

Yes, I am gonna try to make them nestable. After the rework all other attributes support nesting. These are some special cases. I already tried a solution with recursion but I had some big issues.

dbrizov avatar Jan 20 '20 09:01 dbrizov

👍

Is the ScriptableObject-Inspector planned?
Like this image I think this feature is very important ! : )

MingFengShang avatar Jan 20 '20 09:01 MingFengShang

Yes it is. Everything in the issues and pull requests is planned.

dbrizov avatar Jan 20 '20 09:01 dbrizov

👍

MingFengShang avatar Jan 20 '20 09:01 MingFengShang

Hi guy, is it still being updated?

MingFengShang avatar Feb 10 '20 02:02 MingFengShang

@MingFengShang and for people who are stilling waiting for this feature:

I have a project with this feature, and it can be co-used with NaughtyAttributes in the same project.

Here is an example of using attributes like Button in a Serializable class/struct:

[Serializable]
public struct Nest
{
    public string nest2Str;  // normal field
    [Button]  // function button
    private void Nest2Btn() => Debug.Log("Call Nest2Btn");
    // static field (non serializable)
    [ShowInInspector] public static Color StaticColor => Color.cyan;
    // const field (non serializable)
    [ShowInInspector] public const float Pi = 3.14f;
    // normal attribute drawer works as expected
    [BelowImage(maxWidth: 25)] public SpriteRenderer spriteRenderer;

    [DOTweenPlay]  // DOTween helper
    private Sequence PlayColor()
    {
        return DOTween.Sequence()
            .Append(spriteRenderer.DOColor(Color.red, 1f))
            .Append(spriteRenderer.DOColor(Color.green, 1f))
            .Append(spriteRenderer.DOColor(Color.blue, 1f))
            .SetLoops(-1);
    }
    [DOTweenPlay("Position")]
    private Sequence PlayTween2()
    {
        return DOTween.Sequence()
                .Append(spriteRenderer.transform.DOMove(Vector3.up, 1f))
                .Append(spriteRenderer.transform.DOMove(Vector3.right, 1f))
                .Append(spriteRenderer.transform.DOMove(Vector3.down, 1f))
                .Append(spriteRenderer.transform.DOMove(Vector3.left, 1f))
                .Append(spriteRenderer.transform.DOMove(Vector3.zero, 1f))
            ;
    }
}

[SaintsRow]  // magic
public Nest n1;

saints_row

TylerTemp avatar Apr 23 '24 08:04 TylerTemp