• 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 Crayz · Mar 22, 2015 at 04:36 AM · guiinspectorcomponentcustom

Simple text in inspector components?

Curious if its possible to add simple text to my components in the inspector view, rather then having a blank component with no fields it'd be cool to write up a short description of what that component consists of

http://puu.sh/gKoQp/9ac7ab216f.png

Comment
Add comment · Show 3
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 Priyanshu · Mar 22, 2015 at 06:06 AM 0
Share

When i started with Unity. I also wanted something like this.

Would have made easier to remember what each and every component I added does.

But with time, you eventually memorise Unity components. And with scripts. I usually write the description of script inside it at the top :)

avatar image Crayz · Mar 22, 2015 at 06:21 AM 0
Share

Thanks for the reply :) I'm usually pretty good at remembering what my components and systems are up to, I suppose I'm just in a refactoring moment and been documenting/cleaning my code lately, making things as user friendly for myself as possible. I figured being able to write up a short description there would be a neat thing to have in the future while I'm slapping components together

avatar image Priyanshu · Mar 22, 2015 at 06:38 AM 0
Share

http://docs.unity3d.com/ScriptReference/EditorGUI.html

might be of some help.

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by DiegoSLTS · Mar 22, 2015 at 07:30 PM

You can create a custom inspector class for your script and add a HelpBox on it with any text you want. Look here: https://unity3d.com/es/learn/tutorials/modules/intermediate/editor/drawdefaultinspector-function

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 Crayz · Mar 22, 2015 at 07:58 PM 0
Share

That's what I was lookin' for, thanks!

Edit: Just in case anybody finds there way here looking for a similar solution, here's my snippet with rich text enabled.

 [CustomEditor(typeof(AG.RTS.Gameplay$$anonymous$$anagers))]
 public class Gameplay$$anonymous$$anagersEditor : Editor 
 {
     private GUIStyle style;
 
     public override void OnInspectorGUI()
     {
         style = new GUIStyle("HelpBox");
         style.richText = true;
 
         base.DrawDefaultInspector();
 
         EditorGUILayout.TextArea(@"<b>Gameplay $$anonymous$$anagers</b>
 -----------------------------
 <color=blue>Entity$$anonymous$$anager</color> - Collection of every valid entity in-game
 <color=blue>Selection$$anonymous$$anager</color> - $$anonymous$$anages selected units in a collection
 <color=blue>Drawer</color> - GL draws in game-world", style);
     }
 }

http://puu.sh/gLoYa/46e7945bd0.png

avatar image
0

Answer by Xatu1992 · Mar 22, 2015 at 03:25 PM

 var Description : String;

This would work if the string isn't being called to anything.

Comment
Add comment · 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

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.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

23 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 avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Custom GUI Elements in Inspector 0 Answers

Custom Inspector, Access built-in component icons? 2 Answers

Custom inspector, show string instead of component type 0 Answers

How do you get the default inspector to draw for Prefabs ? 2 Answers

Using different custom inspectorscripts 1 Answer

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges