Hello everyone,
i have been practicing Unity now since almost a month and i really thought i did make some progress. Apparently I haven’t (pure frustration) since I seem to lack the very basic understanding of the positioning of objects in the game world and no matter how many posts and documentation i read - I don’t get it.
Lets start simple: i create a white cube in the world. As far as i figured out, what i see in the transform in the inspector IS the actual position of the cube in the gameworld. The little box with the x,y,z arrows is always displayed at the center of the object relative to its position in the world. Thats also means I see that center correctly in #Scene view. So far so good. Now the confusing parts starts:
I turn the white cube into a prefab. How do the transform positions in the inspector and the transform positions inside the prefab correlate? Especially if i add children in the prefab? Will everything stay the same if i click on the prefab object in the hierarchy panel?
Now i add a script to the cube (outside of the prefab but on the prefab (outside not inside) and store its position with test=this.gameobject.transform.position. What position will i get on Debug.Log (test)? Will this change if i add children inside or outside the prefab?
Now i create 3 different cubes. I put those 3 different cubes into an empty gameobject. If i now get the position of the empty gameobject, what will I get? The actual position of the empty gameobject or all the objects combined and then their center?
And last but not least - the little box that has the x,y,z arrows on it - when will it be in the actual center of that gameobject i clicked on and thus tell me the actual position of that object in the world in the case it has children and is not a prefab? Or is it irrelevant wether something is a prefab or not?
Any answers would be much appreciated and free me from my positioning nightmare.
P.s. i tried both transform.position and transform.localPositon