public void TargetMove(NetworkConnection target, int CardSetNum) { GameObject[] obj = GameObject.FindGameObjectsWithTag("CardSet"); CardSet cardSet = null; // 重なるカードを検索 foreach (GameObject cardset in obj) { // 検索出来たら処理をする if (cardset.GetComponent <CardSet>().GameManager.tag == this.tag) { if (cardset.GetComponent <CardSet>().CardNum == CardSetNum) { // 検索結果を一時格納 cardSet = cardset.GetComponent <CardSet>(); // 無駄にループさせない break; } } } cardSet.Move(); }