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
3
Question by roychr · Aug 30, 2012 at 04:14 PM · inspectorcomponentname

Changing script name displayed in inspector

Hi,

I have multiple instances of a script on my game object and would like to change their displayed mono behaviour type displayed name for the component in the inspector. Can it be done via my custom editor for this component, and how ?

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

3 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by lodendsg · Dec 09, 2014 at 07:33 AM

This is an old question however for my purposes you can set [AddComponentMenu("name as string")]

This will set the display name of the component and can put the component under a given menu; handy if you are a content/asset developer for example

 [AddComponentMenu("myName/myProduct/v1/dohicky (v1)")]

and

 [AddComponentMenu("myName/myProduct/v2/dohicky (v2)")]

This will cause the Add Component button in the inspector to show a folder structure also if they search for dohicky they will see dohicky (v1) and dohicky (v2) even if the scripts them selves have the same name. Again probably not what the OP was looking for but the question has come up several times RE set or change component display name so thought it might help others.

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

Answer by landon912 · Aug 31, 2012 at 01:04 AM

You want to change the script name? If so then you will need separate scripts and then you can rename each in the editor to whatever you need.

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 roychr · Aug 31, 2012 at 06:59 PM 0
Share

This is exactly what I do not want to do (split to multiple script), I suspect that components name is necessary for getting the component via reflection so changing it is not possible. They should probably let us modify that at some point but its those kind of things that are so not important... oh well...

avatar image landon912 · Aug 31, 2012 at 07:50 PM 0
Share

Ok you could have said that it in the question, and also you should post this as a comment to my failed answer.

avatar image
0

Answer by landon912 · Aug 31, 2012 at 07:54 PM

In a script you can make a copy of the script useing AddComponent and then store it in a var. That way you can access that script useing that var. You should put this in the function Awake so that it's only creates a copy for the first one.

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.

Follow this Question

Answers Answers and Comments

9 People are following this question.

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

Related Questions

I'm having trouble getting the text in Unity's "text mesh" to change its text at runtime. 1 Answer

Is there any way to change order of inherited fields in inspector? 0 Answers

components and variables - inspector problems 1 Answer

Getting Another Object's ID with Colliders 1 Answer

Inspector:Reference a component in Assets, not in scene. 0 Answers


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