Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 14 Next capture
2021 2022 2023
2 captures
12 Jun 22 - 14 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 YoloJero · Jul 12, 2018 at 12:15 PM · disablecustom editorcustom inspectorobjectfieldcustomize

Is there any way to hide the "Object picker" of an EditorGUILayout.ObjectField ?

I'm just asking if there is any possibility to hide the "Object Picker" (The little knob/menu next to an ObjectField in a custom Inspector. I have some cases where changes are disabled (DisableGroup) and I would like to also hide the knob while the content can not be changed.

alt text

example.png (40.9 kB)
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 hexagonius · Jul 18, 2018 at 12:46 PM 1
Share

would be a nice feature, but since even $$anonymous$$onoBehaviours are greyed out and has the picker, I doubt this exists. worth a feature request.

3 Replies

· Add your reply
  • Sort: 
avatar image
0

Answer by jaiyuan · Oct 27, 2020 at 11:55 AM

ObjectField without picker https://gist.github.com/unity3d-kr/d22b6a6f379947a9e6fdea3ef48df19f

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 jaiyuan · Oct 27, 2020 at 03:42 AM

I make the objectfield without picker.. You can see in my gist https://gist.github.com/unity3d-kr/d22b6a6f379947a9e6fdea3ef48df19f

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 mikelortega · Sep 13, 2021 at 03:48 PM

I would suggest to ignore the result and disable the ObjectField with EditorGUI.DisabledScope. It will show the object, you can use it to select it, but you cannot change the value.

Example:

             using (new EditorGUI.DisabledScope(true))
             {
                 EditorGUILayout.ObjectField(my_object, typeof(GameObject), true);
             }
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 JPoenisch · Sep 15, 2021 at 02:44 PM 1
Share

Hi (different acount here ^^) actually I was already using something similar

 EditorGUI.BeginDisabledGroup(someCondition);
 EditorGUILayout.ObjectField(my_object, typeof(GameObject), true);
 EditorGUI.EndDisabledGroup();

However, as stated in the question the goal was not only to disable it (what I alread did) but also to not disaplay the knob at all ... reason behind it: I wanted to scale the field vertically to make it bigger but this looked pretty ugly because the knob got scaled vertically as well ^^

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

91 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 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 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 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

Custom Inspector: How to Align EditorGUILayout.Objectfield in a Horizontal Group with other EditorGUILayout.Objectfield that aren't in Horizontal Groups? 0 Answers

Custom Editor Vector3Field not working 1 Answer

Trying to create Custom Inspector Labels and I get erros 0 Answers

Custom inspector: How can I find out if a SerializedProperty will be drawn by a custom property drawer? 0 Answers

Unity Editor interface implementation selector? 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