- Home /
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));
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?
It's typeof(Case). In full:
Target.BulletCasing = (Case) EditorGUILayout.ObjectField("Bullet casing", Target.BulletCasing, typeof (Case));
I mean the variable that you drag and drop to. Is it a :Transform variable?
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
![](https://koobas.hobune.stream/wayback/20220613124635im_/https://answers.unity.com/themes/thub/images/avi.jpg)