- Home /
Make gameobject a child without affecting scale?
Hi there,
my question is whether there is some way I have missed of making a gameObject a child of another object without affecting it's local scale?
Example:
Object A has a scale of 1,1,1 and it is not a child of any object.
Object B has a scale of 1,1,0.5.
At runtime, Object A becomes a child of object B. Currently, object z suddenly changes scale along the Z axis to account for the 0.5 of it's parent. Can I avoid this change in any way?
http://answers.unity3d.com/questions/583814/how-to-instantiate-gameobject-as-a-child-without-s.html
This question should give you what you need. Just leave out the instatiate part.
If the size of Object B remains constant, consider editing it so that it has a uniform scale of (1,1,1). It can be done in a modeling program or by editor script in Unity.
Answer by Ed unity · Apr 21, 2014 at 07:06 PM
The localScale of the object is always relative to the parent game object. When you make an object a child of another, you must adjust the scale of the child object so that it's scale is now relative the the scale of the parent object. For example in your case, Object A's localScale should become (1,1,2) as it is 2 times the size on the z as the scale of the parent object.
http://docs.unity3d.com/Documentation/ScriptReference/Transform-localScale.html
Your answer
Follow this Question
Related Questions
Problem with child and parent. 1 Answer
Object scale/rotation changes when parented to flipped object 0 Answers
Good way to scale parent without scaling children? 1 Answer
Make a simple tree 1 Answer