Position of parent-Object

Hi,

my project has a groundplane which symbolised the floor of my room. I have an empty gameobject called "ground-grid", created within a script. The script creates many sub-grids (smaller size) and adds every single grid to my "ground-grid".

subgrid[rxy].GetComponent(Transform).parent = groundgrid.transform;

"Randomly" my script creates 2x2-Grids (to use for such sized objects later). If such a grid appears, the script creates another empty gameobject called the number of currently existing 2x2-grids.

Here's an example of the hierarchy:

ground-grid (empty go) > ... 18,19,20,21, ...
2x2-grid (empty go) > 1 (empty go) > 7,8,17,18
                    > 2 (empty go) > 28,29,38,39

For the sake of convenience i just want to place a 2x2-Obj on parent. For example on "1".

The problem is, that the empty go "1" is positioned in the middle of the for sub-grids, but has the transform.position coords of (0,0,0). If i want to position my object on the same coords it appears in the center of the world (because thats 0,0,0). Can you tell me, how to let the parent go have the right coords?

Greetings, MrJames

I may not be fully understanding your question, but could it be that you're just looking to set the object's localPosition rather than its world position?

I solved the problem by attaching a MeshRenderer component to each object. Than the positionig was correct.