Shortcut to create empty parent with transform of original object?
I would think this would be a common enough problem that there would be a shortcut.
Suppose you place a GameObject in your scene and get it adjusted just the way you want it. Then you realize that you are going to add some other objects and you would like for them all to be under one empty parent. In particular you would like to align them according to the local coordinates of this parent.
Having placed the first object, is it possible to create an empty parent object with its transform taken from the first?
I've been laboriously copying over the position, rotation and scale values by hand and I feel certain that there must be a better way.
I thnk there is no shortcut, but in this cases, i create a script. ITs simple to add a script to several objects at once. :D
@tormentoarmagedoom - I'm confused. Can a script play the same role as a parent object?
No xd!
I mean, if you have multiple objects that needs the same "correction", and you dont want to make it by hand 1 by 1, you can create a script for all of them to make it via code, so don't need to do it by hand.
But anyway, i make you an answer now :D
Answer by tormentoarmagedoom · Jun 26, 2018 at 10:16 AM
Good day.
there is no shortcut for this (or at least i never saw it or listen/read about it)
The best way is to create an empty object child of the original object, set it transfom (Local position) to 0,0,0 . Then by inspector icheracty, move it outside (unparent it) the original object and make the original object child of the emptyobject.
So you will finnaly have a emptyObject with the coorect world position and the originalobject as a child with coords 0,0,0
Bye!
Still, I argue Unity should totally add a "Create Parent" option to the contextual menu for GameObjects.
Answer by mvriel · Jun 27, 2021 at 05:12 AM
I came here from Google and while reading this I came up with a solution that might help anyone else in the future:
After adding the empty parent:
select your child object
Right click on the 'position' label in the Inspector and choose Copy.
Right click again on 'position' label and choose Revert
Select your parent object
Right click on the position label in the inspector and choose Paste.
Voila! The position has now been applied from the child onto the parent. It may not be the most desired outcome but beats having to reposition the parent manually.
Answer by mfatihbarut · Feb 27 at 05:51 AM
There is a shortcut to "Create empty parent" now. (in Unity 2021)