Hi guys is there a way to just write an easy text in the inspector? because I have a bunch of variables (in c#) an I want to give them a sort of title:
public Texture Darkness;
public GUISkin Skin;
public Texture Background;
public float IntroDauer = 2.0f;
private float adopePositionTime = 0.1f;
public float AbstandY = 10;
public float GroesseX = 100;
public float GroesseY = 40;
public Texture topPart;
public float GroesseHeader;
public bool anBildschirmAusrichten = true;
And is there a way to add a text as easy as: static text = “----Intro----”;
Or something like this?
To me that sound like you want a custom inspector for your class. If you don’t write your own inspector for your class, Unity uses the default inspector which just displays all serialized values by it’s variablenames.
Usually variable names should be self-explanatory, so there’s usually no need for writing your own inspector. But if you want to change the description of your variables or change what editor element is shown to edit a certain value, you can write a custom editor.
See the bottom of the Extending the editor page and the Editor class.
A custom inspector can provide a nice interface for your class. You can show a slider with certain min and max values for a float instead of an float field where the user can input any value.
For anyone stumbling upon this question more recently, I wrote a simple PropertyDrawer and PropertyAttribute that you can use to display notes using the built in EditorGUI.HelpBox. It’s a great compliment to the HeaderAttribute mentioned in the comments by @Odyssee and lets you give a little more info. See this forum post for more details:
Hope this helps someone out.