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
2
Question by Jeffom · Jan 07, 2011 at 05:17 PM · editorcustomobjectfield

custom editor EditorGUILayout.ObjectField only shows the assets folder

When i click the field to select the object it only shows the assets folder objects . Is there any way to show the scenes tab ?

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

1 Reply

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

Answer by yoyo · Jan 07, 2011 at 05:39 PM

EditorGUILayout.ObjectField takes a parameter to specify which type of object to select.

In Unity 2.6.1 you can use ...

  • typeof(UnityEngine.Object) -- only shows assets in the selection menu, but you can drag/drop game objects from the scene
  • typeof(GameObject) -- selection menu lets you choose from all your game objects in the scene (and no longer get to choose from assets)
  • typeof(BuiltInComponent) -- lets you select from all components of this type in the scene
  • typeof(ScriptedComponent) -- gives you a large number of objects to choose from, but only accepts ones that have your custom component attached (seems like there's a minor bug)

In Unity 3.1, the selector is much nicer -- a tabbed dialog with preview instead of a huge long menu -- BUT it always restricts the view to assets. The fact that it's tabbed makes it look like it should should support other groups of objects, but it's not there yet. Not sure if this is a bug or a missing feature. I added a feature request here, vote for it if you want it fixed.

Comment
Add comment · Show 6 · 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 Jeffom · Jan 07, 2011 at 05:59 PM 0
Share

this line

EditorGUILayout.ObjectField("Action container", toWaitActionHolder, typeof(GameObject)) as GameObject;

should then show the scene selection tab, but it doesnt :/

avatar image Jeffom · Jan 07, 2011 at 06:05 PM 0
Share

correct me if i'm wrong but the typeof( Type ) field is only to filter the object with the type you want on the selection ,it doesn't really enables or disables the selection from scene or assets.

avatar image yoyo · Jan 07, 2011 at 08:57 PM 0
Share

By setting the type parameter, you control what (types of) objects can be selected. If you use a type that is a native of the scene view (like GameObject or Component) then you will be able to select from objects of that type that are currently in the scene. If you simply use typeof(Object) then you only see objects (assets) from the Project list -- which seems like a bug, but that's how it works. Try it and see.

avatar image yoyo · Jan 07, 2011 at 08:59 PM 0
Share

Disclaimer: I was using Unity 2.6 for my tests. I'll try 3.1 later today.

avatar image yoyo · Jan 07, 2011 at 11:58 PM 0
Share

Hmm, looks like 3.1 has a better interface, but less functionality. I edited my answer with details and the link to a new feature/fix request.

Show more comments

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

No one has followed this question yet.

Related Questions

EditorGUI.ObjectField not working properly in a editor window? 0 Answers

OnGUI elements in editor scene view 1 Answer

editor target cast fail on DLL 0 Answers

CustomEditor for TextureImporter? 2 Answers

Color custom editor 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