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 superpig · Apr 23, 2011 at 10:05 AM · prefabbrowserobjectfield

Prefabs not showing up in the object browser

I've got different bullet casing prefabs in my game - different meshes, sounds, physics setup, etc. Each one has a Case MonoBehaviour attached to it. When setting up my guns, I can tell each gun which bullet casing it should spit out by wiring it up in the inspector.

If I drag and drop the bullet casing prefab into the object field, it works fine.

If I hit the little circle next to the object field to bring up the 'Select Case' window, the window appears but it doesn't list any of my prefabs on the Assets tab. 'None' is the only option.

What gives? Shouldn't all my prefabs with 'Case' behaviors attached show up in that list?

Edit: For completeness, here's the line in my custom inspector that produces the object field:

Target.BulletCasing = (Case) EditorGUILayout.ObjectField("Bullet casing", Target.BulletCasing, typeof (Case));
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
0

Answer by burgunfaust · Apr 23, 2011 at 01:12 PM

If your Drag and drop variable is listed as a transform then it will only look for those not prefabs. What is it listed as?

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 superpig ♦♦ · Apr 23, 2011 at 06:34 PM 0
Share

It's typeof(Case). In full:

 Target.BulletCasing = (Case) EditorGUILayout.ObjectField("Bullet casing", Target.BulletCasing, typeof (Case));
avatar image burgunfaust · Apr 24, 2011 at 12:23 AM 0
Share

I mean the variable that you drag and drop to. Is it a :Transform variable?

avatar image superpig ♦♦ · Apr 24, 2011 at 10:54 AM 0
Share

...no, it's a :Case variable.

avatar image burgunfaust · Apr 24, 2011 at 12:17 PM 0
Share

As far as I know, the object browser will only show types that it knows (Transform, GameObject etc). I don't think it will recognize user defined types. Your typeof(Case) will actually accept just about anything you drag and drop on it. You could try [ExecuteInEdit$$anonymous$$ode()] in your case behaviour and see if that works.

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

Object field select menu can't find resources 0 Answers

Prefab Position 2 Answers

Baked Lighting 1 Answer

When generating prefab, i cant load images from either resource or assetbundle 2 Answers

'Picking up Ball' by destroying Prefab, prefab does not get 'read' 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