I have a procedurally generated tile that is a part of a turn-based hex tile game. When I try to have the tile instantiate a prefab that is the placeholder for a unit, I used the tile's transform.position as the position part of GameObject.Instantiate(Object, Location, Rotation). Unfortunately, this is the result:

Positions of the two objects

A similar thing happens no matter which tile I use.

More information: I tried placing a cube on where the hex is, supposedly. Its transform is very different. So what it appears to be is that the tile is being placed in the wrong place, not the cube.

Further experimentation shows that the cube is appearing at exactly half the hex's apparent transform (I added a multiplier of 2 to the cube's position and it appeared in the right spot). I still have no idea why.

  • \$\begingroup\$ This question is a little confuse. What is the tile used as a placeholder in the image? Is the cube the instantiated GameObject? \$\endgroup\$ Dec 24, 2013 at 14:58
  • \$\begingroup\$ Am I right in assuming the cube was supposed to instantiate on the red tile? Also, are you generating vertices or just spawning GameObjects? \$\endgroup\$ Dec 24, 2013 at 15:12
  • \$\begingroup\$ The red hex is the tile, the cube the instantiated placeholder. The tiles are generated by vertices, but the center of it is where indicated. The center of the cube is at its center, and its position is exactly the same as the position of the hex. \$\endgroup\$ Dec 24, 2013 at 16:07
  • \$\begingroup\$ This kind of transformation seems got wrong because of parent-child relations or so. \$\endgroup\$
    – daniel
    Dec 24, 2013 at 16:25
  • \$\begingroup\$ Are you making the cube a child of anything? Or is the prefab a child of any object? Or have the scale changed to anything other than 1s for either object? \$\endgroup\$
    – House
    Dec 24, 2013 at 16:27


Browse other questions tagged .