Skip to content

Instantly share code, notes, and snippets.

@ApprenticeGC
Created March 21, 2020 09:09
Show Gist options
  • Save ApprenticeGC/4da2556b22b58fd016fe190c698c57e0 to your computer and use it in GitHub Desktop.
Save ApprenticeGC/4da2556b22b58fd016fe190c698c57e0 to your computer and use it in GitHub Desktop.
Create empty grid cell
private void Start()
{
Assert.IsNotNull(gridCellPrefab);
for (var y = 0; y < height; ++y)
{
for (var x = 0; x < width; ++x)
{
var cellPosition = new Vector3(x, y, 0);
var createdInstance = GameObject.Instantiate(gridCellPrefab, cellPosition, Quaternion.identity);
createdInstance.name = $"Grid Cell [{x}, {y}]";
createdInstance.transform.SetParent(transform);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment