In my Inventory script attached to my Inventory GameObject I have this:
public void AddItem (GameObject thing){
invList.Add(thing);
thing.transform.parent = transform;
}
When I run the game and this function is triggered, the GameObject passed as thing is parented under the Inventory( I can see it doing what I want in scene hierarchy), but there’s a problem. The Inventory, which I have moved to a location the player will never go, (-10 in Y for now) is moving up to where the child is. In the editor it shows the y position being -10 (unchanged), but it has visually moved to where the child is. What’s going on? I want the Inventory parent to remain where it was.