複数の子供ObjectのComponentを配列に取得するやり方

private Rigidbody2D[] rigidbody2Ds;
rigidbody2Ds = GetComponentsInChildren<Rigidbody2D>();

現在のGameObjectの子供のObjectのComponentをまとめて取得して、Componentの配列に代入している

タグ:

unity
最終更新:2015年05月29日 20:21