Search Unity

Now I'm possible to tell if the user selected a prefab in project View?

Discussion in 'Prefabs' started by jerotas, Sep 19, 2018.

  1. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    I'm excited about nested prefab features, however I don't see a way in the new Unity API to tell if the user clicked on a prefab in Project view instead of in the scene hierarchy.

    Why does this matter?

    Some plugins we have on the asset store want you to make your own prefab out of a prefab that we provide. If you do not and modify the prefab in our asset folder, your changes will be overwritten the next time you update the plugin, which is just nasty.

    Some users might not read the instructions or know any better so we have put a button there to create a copy of the prefab and disable all other functionality. That button only appears if you selected the prefab in project View and not in the hierarchy of the scene. However I don't see a way to do that detection anymore. If this feature has to go away starting with unity 2018. 3, no doubt some users will get angry when they do the wrong thing.

    So is it possible? To clarify this is for code for a custom inspector.
     
  2. CDF

    CDF

    Joined:
    Sep 14, 2013
    Posts:
    1,311
  3. jerotas

    jerotas

    Joined:
    Sep 4, 2011
    Posts:
    5,572
    Well yeah, there is no custom Inspector on a "project view - selected" prefab. Which is dumb. There used to be. Very helpful for me to be able to show custom things there, especially for new users that don't know much. Otherwise they will inevitably make avoidable mistakes. I can't really help them when they hide this from us!

    Thank you.
     
  4. SteenLund

    SteenLund

    Unity Technologies

    Joined:
    Jan 20, 2011
    Posts:
    639
    How did you previously determine what the used had selected?

    It should still be possible, I am just curious how you used to do it, so I can guide you.
     
    Last edited: Sep 20, 2018