- changed status to closed
OnValueChanged only be triggered at the first layer
Issue #260
closed
[Serializable]
public class DataNode
{
[SerializeField]
[OnValueChanged("OnNextChanged")]
public DataNode Next;
private static int IdCounter;
public int Id;
public DataNode()
{
Id = IdCounter;
IdCounter++;
}
private void OnNextChanged()
{
Test.LogStr = Id + " NextChanged";
}
}
[ExecuteInEditMode]
public class Test : SerializedMonoBehaviour
{
public static string LogStr;
[ShowInInspector, ReadOnly]
public string Log
{
get
{
return LogStr;
}
}
[OdinSerialize]
[NonSerialized]
public DataNode Head;
}
Comments (2)
-
-
reporter It is confused if the IncludeChildren is false, I thought it is triggered when property Next is assigned a new value, then it calls itself method OnNextChanged().
- Log in to comment
The OnValueChanged attribute has overload that enables that behavior.