自分と敵のタワー数を表示する














タワー数の表示
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// 追加
using UnityEngine.UI;
public class GameController : MonoBehaviour
{
private Text towerCountLabel_Blue;
private Text towerCountLabel_Red;
private GameObject[] blueTowers;
private GameObject[] redTowers;
void Start()
{
towerCountLabel_Blue = GameObject.FindWithTag("BlueLabel").GetComponent<Text>();
towerCountLabel_Red = GameObject.FindWithTag("RedLabel").GetComponent<Text>();
}
void Update()
{
blueTowers = GameObject.FindGameObjectsWithTag("BlueTower");
towerCountLabel_Blue.text = "" + blueTowers.Length;
redTowers = GameObject.FindGameObjectsWithTag("RedTower");
towerCountLabel_Red.text = "" + redTowers.Length;
}
}















タワー数の表示
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
// 追加
using UnityEngine.UI;
public class GameController : MonoBehaviour
{
private Text towerCountLabel_Blue;
private Text towerCountLabel_Red;
private GameObject[] blueTowers;
private GameObject[] redTowers;
void Start()
{
towerCountLabel_Blue = GameObject.FindWithTag("BlueLabel").GetComponent<Text>();
towerCountLabel_Red = GameObject.FindWithTag("RedLabel").GetComponent<Text>();
}
void Update()
{
blueTowers = GameObject.FindGameObjectsWithTag("BlueTower");
towerCountLabel_Blue.text = "" + blueTowers.Length;
redTowers = GameObject.FindGameObjectsWithTag("RedTower");
towerCountLabel_Red.text = "" + redTowers.Length;
}
}

自分と敵のタワー数を表示する