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
5
Question by flberger · Jun 05, 2013 at 04:05 PM · c#editorpublic variable

How to prevent Unity editor from renaming public variables?

When a C# Component exports public variables, such as

 public int mTheTest ;
 public int RealGood ;
 public int my_UnderScore ;

they will be displayed in the Editor GUI as

 MTheTest
 Real Good
 My_Under Score

This is misleading, as variables are case-sensitive in C#. Replacing underscores with a space is even worse.

Is it possible to make the editor display variables as-is?

Comment
Add comment · Show 6
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 Ben-Stoneman ♦♦ · Jun 05, 2013 at 04:38 PM 3
Share

It is not possible to display the variable named "TheTest" in the inspector as "TheTest".

You will need to create an editor extension to change this.

(Excellent comments from Veehmot and Neurological)

avatar image numberkruncher · Jun 05, 2013 at 04:59 PM 0
Share

@Veehmot: Thanks, I had forgotten the name of this and had a hard time finding it. In the end I rolled my own function to do the same, but now I guess I can just drop that!

avatar image numberkruncher · Jun 05, 2013 at 05:00 PM 0
Share

The only way to have this shown in the inspector as "TheTest" would be to create a custom inspector GUI like @$$anonymous$$ suggested.

avatar image flberger · Jun 07, 2013 at 01:34 PM 2
Share

@benstoneman can you please give me back the authority to accept answers to my very own questions? I am an educated user and would very much like to take care of accepting answers myself.

avatar image Ben-Stoneman ♦♦ · Jun 10, 2013 at 10:55 AM 0
Share

The answer does not appear to be accepted flberger. You have the power to accept the answer. :)

Show more comments

3 Replies

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

Answer by $$anonymous$$ · Jun 05, 2013 at 04:20 PM

I think isn't possible, as long you put a capital letter it will space it if there isn't another capital letter before.

But mind that it shows that way only in the inspector, it doesn't rename the variable for real. You can still personalize it with a custom editor inspector script. More info in here:

http://docs.unity3d.com/Documentation/Components/gui-ExtendingEditor.html

Comment
Add comment · Show 2 · 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 flberger · Jun 11, 2013 at 08:07 AM 0
Share

Thank you. It's really weird to have to hack an extension to actually see what has been written plainly into the code. I think I'll file a feature request.

avatar image flberger · Jun 11, 2013 at 08:20 AM 0
Share

Feature request: $$anonymous$$ake confusing nicified variable names in the editor optional

avatar image
8

Answer by Veehmot · Jun 05, 2013 at 04:18 PM

I don't think there's a way to do that. I don't think there's a reason to do it anyways. The process of converting the names is called nicify, and is achieved by calling ObjectNames.NicifyVariableName, if that's any help.

Comment
Add comment · Show 2 · 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 flberger · Jun 11, 2013 at 08:11 AM 0
Share

The reason is at each developer's discretion, I think. :-) In our case, Unity is being used by both experienced developers and artists with little coding background. The latter occasionally have to touch scripts, and they often either a) don't recognize variables because of their different na$$anonymous$$g (thing Ctrl+F) or b) think that Variables are case-insensitive. Both is caused by the unnecessary name mangling.

avatar image $$anonymous$$ · Jun 11, 2013 at 10:21 AM 1
Share

I voted your idea, I agree that may put stuff more ordered for others to see codes, like for your artists, so they aren't forced to open scripts all the time.

avatar image
2

Answer by It3ration · Jan 02, 2014 at 12:30 AM

This needs to be configurable - why not have a custom attribute? In other words:

[InspectorName( "Last Name" )] public string m_last_name = "";

I'm an engine programmer just starting to prototype in unity. I was very surprised that this feature wasn't present.

Comment
Add comment · Show 2 · 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 numberkruncher · Jan 02, 2014 at 12:43 AM 0
Share

I would recommend posting your feedback using the dedicated feedback system: http://feedback.unity3d.com/

avatar image It3ration · Jan 02, 2014 at 12:44 AM 0
Share

I have added a specific request for this feature here:

http://feedback.unity3d.com/suggestions/allow-options-to-control-the-name-mangling-of-public-class-members-in-the-inspector

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

19 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

Related Questions

Initialising List array for use in a custom Editor 1 Answer

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 Answers

How to optimize a custom editor ? 3 Answers

Editor script - any callback when target is first instantiated? 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