Reputation: 71
I create several prefabs and I want to know their x and y, that is defined by a Grid Layout Group.
I do:
var newArtist = (GameObject) Instantiate(myPrefab, new Vector3(0, 0, 0), Quaternion.identity, panel.transform);
Debug.Log(newArtist.transform.position.x + " " + newArtist.transform.position.y);
It appears 0 0 in all.
Upvotes: 0
Views: 343
Reputation: 76
Try this:
var newArtist = (GameObject) Instantiate(myPrefab, myPrefab.transform.position, Quaternion.identity, panel.transform);
Upvotes: 0