Answer the question
In order to leave comments, you need to log in
Why is information from the sheet removed from a static field?
Like there is a static sheet:
public static List<Cell> AllCell = new List<Cell>();
[ContextMenu("Generate grid")]
public void GenerateGrid()
{
for(int x = 0; x < _gridSize.x; x++)
{
for(int z = 0; z < _gridSize.z; z++)
{
var cell = Instantiate(_cell, position, Quaternion.identity, _parent.transform);
cell.name = $"Cell: x:{x}, z:{z}";
GridActions.AllCell.Add(cell); // ВАЖНЫЕ СТРОЧКИ
print(GridActions.AllCell[GridActions.AllCell.Count - 1].name); // И ЭТО
}
}
}
private void Start()
{
foreach(Cell cell in GridActions.AllCell)
{
print(cell.name);
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question