private void UpdateTileObject() { int index = tile.GetData(); if (index == curIndex) { return; } if (index >= 0 && index < prefabs.Length) { GameObject.Destroy(tileObject); tileObject = GameObject.Instantiate(prefabs [index]) as GameObject; tileObject.transform.parent = transform; tileObject.transform.localPosition = Vector3.zero; curIndex = index; } }