Question by
flashfreakmx · Jan 09, 2016 at 06:43 PM ·
scaleparentparent transform
Why does adding a GameObject to another change the scale, when something that already exists as it's child's scale is fine?
I am building a map of my world.
created_tile = GameObject.Instantiate (mapPiece, tile_location, Quaternion.identity) as GameObject;
//created_tile.transform.Rotate (0, 0, 0);
if (created_tile) {
created_tile.transform.parent = mapPanel.transform;
created_tile.layer = LayerMask.NameToLayer ("UI");
drawnMap [x, y] = created_tile;
}
mapPanel's localScale is 1,1,1
my created_tile's localScale is 1,1,1
however when I add created_tile.transform.parent = mapPanel.transform the created_tile's local scale becomes 0.8,0.8,0.8
if I do created_tile.transform.SetParent(mapPanel.transform, false) then the tiles are not positioned in the right place anymore.
What can I do?
Comment
Try : created_tile.transform.SetParent(mapPanel.transform, true);
Why not just set its local scale back to 1,1,1 after you setposition? I know its hacky and shouldn't be nescessary, but hey.