Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 11 Next capture
2021 2022 2023
1 capture
11 Jun 22 - 11 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 JDuaneJ · Jul 21, 2015 at 02:30 AM · unity 5gameobjecticon

Assign GameObject Icons, More Than Just One at a Time?

Ok, I can't believe I have to select each GameObject separately to assign multiple objects the same icon. How can I achieve this? I have over 200 camera labels that were messed up with the Unity 5 upgrade, and I'd like to avoid taking the time just to assign them the same icon.

Much thanks for any help.

Comment
Add comment · Show 4
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 allenallenallen · Jul 21, 2015 at 04:46 AM 0
Share

I guess you can do it by code but that would require some time to set up.

For example, you can add the icons using Resources to an UI object. Then via code, you set the camera labels to this UI object.

It's still time consu$$anonymous$$g though. But if you do it right, the next time something like this happens, the code will take care of it since it takes the files directly from the Resources folder.

avatar image satanin · May 19, 2016 at 01:50 PM 0
Share

Did you find a solution to this?. Im having the same problem, I need to change the icon to ~300 gameobjects and I can't believe that I have to do it one at a time.

avatar image JDuaneJ satanin · May 19, 2016 at 08:25 PM 0
Share

I never did. I spent half a day looking for a solution, then decided to just plow through it. Grab some coffee or a beer and just get through it. :( Hopefully they're listening!

avatar image satanin JDuaneJ · May 19, 2016 at 09:58 PM 0
Share

Thank you for taking the time to answer, I'm afraid I'll have to do the same.

1 Reply

· Add your reply
  • Sort: 
avatar image
4

Answer by ShawnFeatherly · Sep 08, 2016 at 09:42 PM

Found a script that'll assign the icon for one gameobject at: http://forum.unity3d.com/threads/editor-script-to-set-icons-impossible.187975/ It uses reflection to get the job done.

 public static void AssignIcon(GameObject g)
 {
     Texture2D tex = UnityEditor.EditorGUIUtility.IconContent("sv_label_0").image as Texture2D;
     Type editorGUIUtilityType = typeof(UnityEditor.EditorGUIUtility);
     System.Reflection.BindingFlags bindingFlags = System.Reflection.BindingFlags.InvokeMethod | System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic;
     object[] args = new object[] { g, tex };
     editorGUIUtilityType.InvokeMember("SetIconForObject", bindingFlags, null, null, args);
 }

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 antoined73 · Apr 23, 2020 at 01:04 PM 0
Share

Tried this code to apply an icon dynamically for scriptable objects of the same class depending of their content. Apparently its not possible : https://www.reddit.com/r/Unity3D/comments/g13odm/unique_icon_to_every_specific_scriptable_object/

This code changed the default icon of all the scriptable objects instances of the same class.

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

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

Related Questions

Model not rendered on Android Lollipop 5.0.1 0 Answers

How to select gameobjects on android by touching on them? 1 Answer

Moving a GameObject to a certain point in world space via script 1 Answer

Key Arrows into Swipe Input 0 Answers

Move Rigidbody along curve 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