I have a class
[Serializable]
public class AnimationData{
[HideInInspector] public string name;
public int layer = 0;
public EnumTypeAnimation typeAnimation;
public AnimationClip clip;
[HideInInspector] public float speed = 1f;
[HideInInspector] public float fade = 0.2f;
}
and there is a list in the editor with this class, adding and configuring is convenient, but I would like to add one function - for example, when a certain typeAnimation field is selected, I need other fields to be displayed or hidden. If it were not a list, then I know how to do it, but it is not possible to hide or display fields for each element in the list based on the values of its fields, tell me how to do this?
You can use Property drawers to customise how a serialized class/struct is drawn: Unity - Scripting API: PropertyDrawer
this class is on the list
in this situation I need to hide some fields in the entry itself from the list
That… doesn’t change my answer. You still will need to write a property drawer for the class.
If you don’t want to write your own drawers you can use Odin or similar tools (there are free ones too, search on Discussions/GitHub). They have various attributes like ShowIf/HideIf, EnableIf/DisableIf and so on…
I thought you could use something like this, like 1-2 lines
EditorGUILayout.PropertyField(weightFoot);
and here it turns out that a lot of code is needed to hide or show fields, that is, you only need to go that deep into the code?