I have a prefab created by joining several cylinders using hinge joints. I can resize the prefab during design time to any value and it works perfectly in game.
I decide to resize the object in run time based on the screen resolution using following code.
void Awake()
{
float screenHeight = Screen.height/2;
int scaleValue = (int)(screenHeight/160);
gameObject.transform.localScale = new Vector3(scaleValue,scaleValue,scaleValue);
}
when i do that cylinders make up the prefab are not in the correct positions. But they are in correct positions if I re-size to the same value in editor.
Can anyone explain why this is happening?