Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

share|improve this question

closed as off-topic by Josh Petrie Aug 1 '14 at 15:32

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions about debugging a problem in your project must present a concise selection of code and context so as to allow a reader to diagnose the issue without needing to read all of your code or to engage in extensive back-and-forth dialog. For more information, see this meta thread." – Josh Petrie
If this question can be reworded to fit the rules in the help center, please edit the question.

This question is a little confuse. What is the tile used as a placeholder in the image? Is the cube the instantiated GameObject? – dsilva.vinicius Dec 24 '13 at 14:58
Am I right in assuming the cube was supposed to instantiate on the red tile? Also, are you generating vertices or just spawning GameObjects? – Xerosigma Dec 24 '13 at 15:12
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. – Garan Dec 24 '13 at 16:07
This kind of transformation seems got wrong because of parent-child relations or so. – daniel Dec 24 '13 at 16:25
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? – Byte56 Dec 24 '13 at 16:27

Browse other questions tagged or ask your own question.