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 spraycanmansam · Mar 12, 2014 at 05:32 AM · guieditorinspectorcomponenticons

Custom Inspector, Access built-in component icons?

Hi guys. I'm writing a custom inspector that overrides the default transform component inspector. It displays the components attached to the game object. I was wondering if anyone has come across a way to access Unity's built-in component 16x16 icons that displays next to the components name shown in the inspector? Ie, the C#, Js, rigidbody, collider, etc icons. Is there a way to access these internally, or, if that's not possible, can I locate them anywhere from the Unity installation? Thanks for your time,

Kind Regards, Sam

Comment
Add comment · Show 1
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 spraycanmansam · Mar 15, 2014 at 08:21 PM 0
Share

Still looking :)

2 Replies

· Add your reply
  • Sort: 
avatar image
2

Answer by AndyGainey · Jan 23, 2016 at 01:28 AM

EditorGUIUtility.ObjectContent(Object obj, System.Type objType) did the trick for me. It returns a GUIContent instance with the image and text set appropriately, just as if you were using EditorGUI.ObjectField().

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 Rodolfo-Rubens · May 04, 2017 at 11:25 PM 0
Share

Amazing, just what I was looking for!

avatar image
0

Answer by fafase · Mar 15, 2014 at 08:38 PM

Would that be what you are after?

http://answers.unity3d.com/questions/365137/how-to-change-component-icon-shown.html

EDIT: Accroding to the link below, it can only be done via inspector and not at runtime http://answers.unity3d.com/questions/7983/changing-the-inspector-titlebar-icon-and-text.html

EDIT AGAIN: If you open a meta file from a script it will display what is the icon. Problem it is an information that you cannot really use as it looks like this:

 fileFormatVersion: 2
 guid: edaad01d80168b44da722af7b39bfc7b
 MonoImporter:
   serializedVersion: 2
   defaultReferences: []
   executionOrder: 0
   icon: {fileID: -1376725286, guid: 0000000000000000d000000000000000, type: 0}
   userData: 

If the default is used you get :

   icon: {instanceID: 0 }
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 spraycanmansam · Mar 15, 2014 at 08:46 PM 0
Share

Thats similar to what I'm after, but I don't need to change them, I need a way to access those icons from script to display them elsewhere :)

avatar image Ben-BearFish · Jul 16, 2015 at 08:56 PM 0
Share

Was there ever a solution found for this? I'm trying to do the same thing.

avatar image Ben-BearFish · Jul 16, 2015 at 09:06 PM 0
Share

Currently, my only solution is to take a screen cap of the pre-defined icons and save them as a png in the Gizmos folder. It works, but not the most elegant solution.

avatar image spraycanmansam · Aug 20, 2015 at 05:45 AM 0
Share

No, I never did find a nice way to do this :/

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

22 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

Related Questions

Use of the inspector along with a custom editorwindow 1 Answer

TexturePropertySingleLine in Editor class 0 Answers

Get default preview for GameObject Editor 2 Answers

Unexpected selection state in custom inspector? 1 Answer

Customize arrays and classes in inspector window 2 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