Skip to content

Instantly share code, notes, and snippets.

@TheAllenChou
Created November 30, 2018 05:08
Show Gist options
  • Save TheAllenChou/bd3d289cc150f9b24e69c5629a9730c6 to your computer and use it in GitHub Desktop.
Save TheAllenChou/bd3d289cc150f9b24e69c5629a9730c6 to your computer and use it in GitHub Desktop.
List<GameObject> sprites;
List<GameObject> nameTextFields;
for (int i = 0, n = sprites.Length; i < n; ++i)
{
var s = sprites[i];
var ntf = nameTextFields[i];
int row = i / numCols;
int col = i % numCols;
s.transform.position =
new Vector3(col * colSize, row * rowSize, 0.0f);
ntf.transform.position =
s.transform.position
+ textFieldOffset;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment