I have very simple code to instantiate a prefab object that is set like so many tutorial examples I am currently following. I am finding however, that my object below has a scale changed to (2, 2, 2), instead of (1, 1, 1). I have to have that last bit of code to fix it, setting the localScale. But, I don’t understand why I need to do this.
itemListContainer is a VerticalLayout container. Is the layout script setting my object’s below with this scale? Where is it coming from?
public void LoadItems(){
Vector3 position = itemListContainer.transform.position;
Quaternion rotation = itemListContainer.transform.rotation;
foreach (Transform child in itemListContainer.transform) {
GameObject.Destroy(child.gameObject);
}
foreach (GameSpriteData o in spriteList) {
GameObject itm = (GameObject) Instantiate(storeItemPrefab, position, rotation);
itm.transform.parent = itemListContainer.transform;
//itm.transform.localScale = Vector3.one;
}
}