Figured out the issue. Force of habit led me to pass position and rotation parameters on instantiate.
GameObject icon = Instantiate(Resources.Load(“BuildingPlanMaterialIcon”), Vector3.zero, Quaternion.Identity) as GameObject;
Taking those two extra parameters out fixed it. But I’m still confused as to why instantiating the prefab at Vector3.zero would affect the local position of the “QtyFill” child object of the instantiated prefab.
Also I’m just parenting to a layout group gameobject that I have defined on my Master UI script.
icon.transform.parent = selector.MasterUIClass.BuildingPlanMaterialWindow.transform;
Use Transform.SetParent() with the second argument set to false, it is the correct way for GUI elements and we are contempleting removing the other option (or at least deprecating it)
I found the SetParent function super useful for implementing a tooltip: I used SetParent(…,false) to position the tooltip relative to a child object, and then used SetParent(…,true) to move it into the top level of the canvas so it would be in the same position but drawn above everything else.