public void PutNewChess(GameObject prefab) { Vector2Int pos = FindNearestEmptyPosition((xMax + xMin) / 2, (yMax + yMin) / 2, FindPositionType.OUT_BOARD); GameObject newChessObj = Instantiate <GameObject> (prefab); newChessObj.transform.parent = GameObject.Find("Chesses").transform; ChessController chess = newChessObj.GetComponent <ChessController> (); chess.state = MyUtil.CommonUtil.ChessState.READY; chess.x = pos.x; chess.y = pos.y; chess.state = ChessState.MANAGE; chess.team = ownerTeam; chess.enemyTeam = enemyTeam; newChessObj.SetActive(true); chess.BoardReady(this); chesses.Add(chess); }