FindTag
で良いかと思っていたけど、これだと1件しか取得できないぽい。
複数件取得するにはFindGameObjectsWithTag
を使う
全ゲームオブジェクトを読み込んでから、ゲームがスタートする時に数を初期化したいのでこんな感じで書くと良い。
int targetCount;
void Start() {
targetCount = GameObject.FindGameObjectsWithTag ("TargetObject").Length;
}
Go to list of users who liked
More than 5 years have passed since last update.
FindTag
で良いかと思っていたけど、これだと1件しか取得できないぽい。
複数件取得するにはFindGameObjectsWithTag
を使う
全ゲームオブジェクトを読み込んでから、ゲームがスタートする時に数を初期化したいのでこんな感じで書くと良い。
int targetCount;
void Start() {
targetCount = GameObject.FindGameObjectsWithTag ("TargetObject").Length;
}
Register as a new user and use Qiita more conveniently
Go to list of users who liked