Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by bubblegumsoldier · Jun 24, 2012 at 10:56 AM · texteditorguilabel

Easy text in the inspector

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?

Comment
Add comment · Show 4
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Mizuho · Jun 24, 2012 at 11:04 AM 1
Share

*Does not really understand.*

avatar image bubblegumsoldier · Jun 24, 2012 at 11:06 AM 0
Share

so basically the EditorGUI doesn't work

avatar image Bunny83 · Jun 24, 2012 at 12:04 PM 1
Share

btw, it' funny you mix english and german names ;) You should stick to one language it just gets confusing that way. Usually the best choice is english variable, class and function names. German has some nasty special characters ;)

Also keep in $$anonymous$$d there are vector types (Vector2, Vector3, "Vector4">http://unity3d.com/support/documentation/ScriptReference/Vector4.html>"Vector4) which combine x and y into one variable (of course Vector3 has additionally z and Vector4 z and w).

avatar image bubblegumsoldier · Jul 11, 2012 at 12:55 PM 0
Share

yes I realized it afterwards also ;D sorry for that

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by Bunny83 · Jun 24, 2012 at 11:56 AM

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.

Comment
Add comment · Show 4 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Odyssee · Apr 28, 2016 at 11:06 AM 4
Share

If someone have a similar problem, try using HeaderAttribute

[Header("Your title")]

 using UnityEngine;
 using System.Collections;
 
 public class ExampleClass : $$anonymous$$onoBehaviour {
     [Header("Health Settings")]
     public int health = 0;
     public int maxHealth = 100;
     [Header("Shield Settings")]
     public int shield = 0;
     public int maxShield = 0;
 }

Wich result in

alt text

header-answer.png (10.7 kB)
avatar image Bunny83 Odyssee · Apr 28, 2016 at 11:08 AM 0
Share

Just want to add that the HeaderAttribute was added recently ^^. This question is four years old.

avatar image Odyssee Bunny83 · Apr 28, 2016 at 11:10 AM 1
Share

Thanks, yes I know, but in the case someone find this question randomly (as I did looking for something else), i gave an answer ^^

Show more comments
avatar image
1

Answer by usergame · Mar 28, 2017 at 04:34 PM

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:

https://forum.unity3d.com/threads/helpattribute-allows-you-to-use-helpbox-in-the-unity-inspector-window.462768/

Hope this helps someone out.

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image saporter · Apr 30, 2020 at 12:39 AM 0
Share

This did help. Thanks!

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

11 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Simple headline / title for a Script in the Inspector 3 Answers

Unity GUI text displaying as noise 1 Answer

Unity 4.1.2 Dynamic text disappears 0 Answers

Can't draw GUI.Label text on subpixel values 0 Answers

Find the position of text on the screen 1 Answer


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges