private void CreateGrig() { gridstartx = gameObject.GetComponent <Transform>().position.x - 3.5f; gridstarty = gameObject.GetComponent <Transform>().position.y + 3f; for (int y = 0; y < Constant.YGrid; y++) { Line line = new Line(); for (int x = 0; x < Constant.XGrid; x++) { GameObject newslot = LeanPool.Spawn(ElementPrefab); TileView tileView = newslot.GetComponent <TileView>(); tileView.Init(new Point(x, y)); newslot.transform.position = new Vector3(gridstartx + x * 1.7f, gridstarty - y * 2, 1); newslot.name = "slot_" + x.ToString() + "_" + y.ToString(); newslot.transform.parent = gameObject.transform; AllElement.Add(tileView); line.AddElement(tileView); } AllLine.Add(line); line.Init(); } }