Search Unity

  1. Looking for a job or to hire someone for a project? Check out the re-opened job forums.
    Dismiss Notice
  2. Unity 2020 LTS & Unity 2021.1 have been released.
    Dismiss Notice
  3. Good news ✨ We have more Unite Now videos available for you to watch on-demand! Come check them out and ask our experts any questions!
    Dismiss Notice

ObjectPicker during Prefab Edit

Discussion in 'Immediate Mode GUI (IMGUI)' started by brownboot67, Dec 22, 2020.

  1. brownboot67

    brownboot67

    Joined:
    Jan 5, 2013
    Posts:
    372
    I have a Custom Inspector and I'm trying use the Object Picker to select one of the child objects inside my prefab, specifically while I am in "Prefab Editing Mode".

    If I have a SerializedProperty for some sort of Object Reference, say a Transform, and I use PropertyField to draw it, the Object Picker picks from within the prefab with no problem.

    BUT, if I roll my own ObjectField or ObjectPicker, no objects of any type show up under the 'self' tab.

    Some secret magic is happening here and I can't figure out how to make it work. Anybody have any ideas?

    Edit: I'm in 2019.4
     
    Last edited: Dec 22, 2020
  2. brownboot67

    brownboot67

    Joined:
    Jan 5, 2013
    Posts:
    372
    Here's a pic that outlines the different cases:

    prefab_mystery.jpg
     
unityunity