#Removing Header and Arrow for Serializable Object

1 messages · Page 1 of 1 (latest)

shrewd crow
#

https://forum.unity.com/threads/system-serializable-remove-foldout-arrow.1345403/

So I have the similar problem (as attached link above), my question will be instead of making a property drawer for each class is there any better way?

What I found so far:

  • use GUIContent.None can only remove the name but the arrow still there with a empty space which I don't need too

Creating so many property drawer is quite a hustle. In future if I will to add a new property in those class I need to update their property drawer too (which I might forget and panic because I don't see the new variable), but I will say this is the last option if there is no other solution

rustic shuttle
#

You might be able to make one property drawer that responds to a certain attribute, and dynamically draws properties.
The only tricky thing - as always with custom editors - would be lists.

shrewd crow
#

I dont think so because my classes are unique for example :
public class A
{
string num1
int num2
}
public class B
{
enum num1
int num2
float num3
}

etc...

rustic shuttle
#

Doesn't matter. You don't have to hard-code displaying properties; you could just iterate through child properties of your class using SerializedProperty.GetEnumerator()