Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
2 captures
13 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
5
Question by echo17 · Dec 10, 2012 at 03:04 PM · objectcustomemptyobjectfield

EditorGUILayout.ObjectField displays empty list in Object Picker Window

In Unity 3.5.6 and earlier, I was able to use the ObjectField control to pick assets of a custom type. I created a TextureAtlas class that inherited from Scriptable. You could select one of these assets by clicking on the ObjectField control and choosing the atlas asset from the list in the Object picker.

In Unity 4, this functionality appears to have gone away. Now when the object picker window pops up, it is empty (except for the choice of "None"). It works when I use a generic type like "Object", but not on my custom class "TextureAtlas".

Is this a bug in Unity 4?

Code:

 TextureAtlas selectedAtlas;
     
 TextureAtlas newAtlas = (TextureAtlas)EditorGUILayout.ObjectField(selectedAtlas, typeof(TextureAtlas), false);
Comment
Add comment · Show 6
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 Jake.OConnor · Dec 10, 2012 at 03:32 PM 0
Share

I don't oft make things derived from ScriptableObject, but you may need to ensure that the derived class (TextureAtlas) is set as serializable.

avatar image echo17 · Dec 10, 2012 at 04:19 PM 0
Share

Thanks for the answer, but that didn't make it appear in the list.

avatar image Goldseeker · Jun 05, 2013 at 03:53 PM 0
Share

I am having the same problem, did you come up with any solution?

avatar image echo17 · Jun 05, 2013 at 04:11 PM 0
Share

Sort of, but it didn't solve the problem directly. Ins$$anonymous$$d, in the inspector in the OnEnable function, I gather a list of resources of the type I'm looking for. In the OnInspectorGUI function I display those resources in a popup list for the user to choose. I keep a list of names and a list of object references. The user sees the names, but behind the scenes I store the object reference based on the index that is selected.

avatar image Goldseeker · Jun 05, 2013 at 06:12 PM 0
Share

Yeah, i was afraid that it was the only solution. But it is so unfair because built in object fields have this functionality! So sad =(

Show more comments

0 Replies

· Add your reply
  • Sort: 

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

12 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

Related Questions

Suggestion needed for combining the custom objects 1 Answer

'type mismatch' at custom inspector .asset 0 Answers

use custom object in RPC 0 Answers

How to make an empty object to follow part of a sprite? 2 Answers

How to preserve array of custom objects in inspector? 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