Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NaughtyAttributes doesn't work in StateMachineBehaviour #22

Closed
dbokser opened this issue Jul 11, 2018 · 3 comments
Closed

NaughtyAttributes doesn't work in StateMachineBehaviour #22

dbokser opened this issue Jul 11, 2018 · 3 comments

Comments

@dbokser
Copy link

dbokser commented Jul 11, 2018

NaughtyAttributes doesn't do anything when attached to attributes in a StateMachineBehaviour

`public class SetRandomParameter : StateMachineBehaviour {

public string parameter;
            
public enum ParameterType { integer, floatingPoint };
[SerializeField]
private ParameterType _parameterType;

[ShowIf("IsInt")]
public int min;
[ShowIf("IsInt")]
public int max;

[ShowIf("IsFloat")]
public Vector2 range;

private bool IsInt()
{
    return _parameterType == ParameterType.integer;
}
private bool IsFloat()
{
    return _parameterType == ParameterType.floatingPoint;
}


// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state
override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
{
        
}

}`

image

@dbrizov dbrizov closed this as completed Jan 11, 2020
@dbrizov dbrizov reopened this Jan 11, 2020
@dbrizov
Copy link
Owner

dbrizov commented Feb 4, 2020

The attributes implemented via CustomPropertyDrawer are now working. The custom ones like (Button, ReorderableList) aren't. The problem is that OnEnable() and OnDisable() methods of the StateMachineBehviours are not called. I don't know why :(

@dbrizov dbrizov closed this as completed Feb 4, 2020
@Kotsuha
Copy link

Kotsuha commented Jun 25, 2021

Tested in Unity 2021.1.7f1

using System.Collections;
using System.Collections.Generic;
using NaughtyAttributes;
using UnityEngine;

namespace MakeSomething
{
    public class TestState : StateMachineBehaviour
    {
        public int Foo;

        [SerializeField]
        private int _bar;

        [ShowNonSerializedField] // Doesn't work
        private int _baz;

        [ReadOnly] // Doesn't work
        [SerializeField]
        private int _qux;
    }
}

@jnbbender
Copy link

Is there a reason why this was closed?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants