public void Fill(int x, int y, int z, int r, int damage, Side side) { GameObject copy = Instantiate(orePrefabs[r], transform.position + new Vector3(x * spacing, y * spacing, z * depthSpacing), transform.rotation, layers[z]); Ore o = copy.GetComponent <Ore>(); o.SetSortOrder(-z * 10); if (damage > 0) { //Debug.Log($"Random Damage {damage}"); o.Smash(damage, side, true); } grid[x, y, z] = o; }