Search Unity

Suggestion: PrefabUtility.InstantiatePrefab should support default parent

Discussion in 'General Discussion' started by FlaSh-G, Jul 30, 2021.

  1. FlaSh-G

    FlaSh-G

    Joined:
    Apr 21, 2010
    Posts:
    212
    Hi! I hope I'm in the right forum for a little suggestion.

    First off, I'd like to say that the default parent feature I recently stumbled upon is super cool and makes a huge difference for my workflow because of the way my scenes are set up. I've got a little tool that I use for quick scene editing that uses PrefabUtility.InstantiatePrefab() to instantiate the selected prefab wherever I click in the scene view. I've noticed that the method sadly ignores the default parent I've set.

    Now, the suggestion: It would be really great if InstantiatePrefab() would make the instantiated object a child of the default parent, either by default or via parameter. Alternatively (or additionally), it could be nice to have the option to receive a reference to the default parent from EditorUtility, which currently only allows setting or clearing it.

    Greetings!
     
  2. ippdev

    ippdev

    Joined:
    Feb 7, 2010
    Posts:
    3,853
    What is the issue with simply setting the parent from your editor tool?
     
  3. FlaSh-G

    FlaSh-G

    Joined:
    Apr 21, 2010
    Posts:
    212
    I want myself and other users of the tool to be able to set the default parent in the regular way (right clicking an object in the hierarchy), and my tool adhering to the decision. Rebuilding that mechanic in my tool somehow just to be able to kinda-kinda-not-replace the existing menu item would feel really hacky-dirty.
    Also, in general, wouldn't it just make sense for InstantiatePrefab() to support the default parent?