I'm creating a simple text-based puzzle that will have a varied number of clues, determined at runtime. I figured I should do this by instantiating a number of prefabs. Here's what it looks like right now.
Notice the transform values. The prefab in Assets has the exact same values.
To test to see if I could instantiate a bunch of Puzzle objects at runtime, I created this simple loop:
for (int x = 1; x < 6; x++)
{
Debug.Log(15-x);
Instantiate(puzzle, new Vector2(0, 15 - x), Quaternion.identity, GameObject.FindGameObjectWithTag("Canvas").transform);
}
The idea being all the clones would stack beneath the first Puzzle object. However, this is what happens when I run it:
The clones are being stacked at the wrong position. I used the debug log to confirm the correct values are being used for the vector, and I've tried using Vector3 as well. There are a lot of similar questions on the unity forums, but none of those solutions worked for me. Any insight would be greatly appreciated.