uint
uint

Reputation: 71

How to get position from grid?

I want the Pos X and Pos Y

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

Answers (1)

ShooterLens Aim
ShooterLens Aim

Reputation: 76

Try this:

var newArtist = (GameObject) Instantiate(myPrefab, myPrefab.transform.position, Quaternion.identity, panel.transform);

Upvotes: 0

Related Questions