From a developer pe...
 
Notifications
Clear all

From a developer perspective: How did you...

dwinblood
(@dwinblood)
New Member

I've been looking at your code and I was very curious how you managed to get the orange inspector properties, and implement the overall style for that.   I was just looking at MotionController.cs.   I noticed while you have Summary comments they do not match the tooltips that pop up when I hover over a field in the inspector.  Yet I see no sign of a tooltip or anything like that.   If you are willing to share information on how you accomplished that and where I should look I'd love to know.   If you want to keep that to yourself that is okay too...  

Quote
Topic starter Posted : 02/02/2021 2:31 pm
Tim
 Tim
(@timtryz)
Member Admin

Hi @dwinblood .  I have no problem sharing. 🙂

 

For the Motion Controller, you'll find there's a MotionControllerEditor.cs file. That's where the inspector is written. In it, you'll find a function like this:

EditorHelper.TextField("Name", "Friendly name of the layer.", rLayer.Name, mTarget)

It uses my EditorHelper.cs file and that's where all my drawing happens. You can see a lot of inspector type code in there. For the tooltip, I use Unity's function like this:

FieldStringValue = EditorGUILayout.TextField(new GUIContent(rTitle, rTip), rValue);

So, I'm just using Unity's TextField(...) function with a GUIContent object. That allows me to have the title (what is displayed as the field name) and the tooltip.

 

I hope that helps,

Tim

 

ReplyQuote
Posted : 06/02/2021 7:04 pm
Drax liked
Share: