Created
March 21, 2020 09:09
-
-
Save ApprenticeGC/4da2556b22b58fd016fe190c698c57e0 to your computer and use it in GitHub Desktop.
Create empty grid cell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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