EditorUtility should have a GetDefaultParentObject method

The Default Parent feature is really handy in the editor, but there are a number of assets that create GameObjects (e.g. UModeler Pro) that have to create GameObjects outside of the Default Parent because there is no GetDefaultParentObject method in the EditorUtility class. There are the SetDefaultParentObject and ClearDefaultParentObject methods but none to get the Default Parent object.
[
Unity - Scripting API: EditorUtility](http:// Unity - Scripting API: EditorUtility)

This would be very useful for maintaining a workflow where GameObjects for level design are kept under the same parent, regardless of whether they’re created using the create GameObject context menu or created by an asset.

It looks like there is a SceneView.GetDefaultParentObjectIfSet() method:

But based on the source code this is an internal method that is only available for Unity Editor code, not user editor code:

It would be very useful to have this code exposed for users in the EditorUtility class to allow assets and custom editors to be able to access the Default Parent GameObject.

Yes, it is absolute madness that GetDefaultParentObject does not exist.

1 Like

Adding the internal static method as I realized the specific line was not clear, it seems like adding this would be a matter of making this method public and not internal:

Making this method public would be EXTREMELY useful for creating tools that create GameObjects and have them work/integrate with the default parent feature, as it currently stands from what I’ve seen tools handle this either by not parenting GameObjects or by using their own system for determining what parent to use. Additionally, having a setter but not a getter seems like a code-smell.