Unity FindGameObjectsWithTag

用法

const tag = "fish";

GameObject[] fishs = GameObject.FindGameObjectsWithTag(fish);

注意 获取的顺序是随机的  不是面板上排好的顺序

排序

const fishTag= "fish";

//排序前

 GameObject[] fishs = GameObject.FindGameObjectsWithTag( fishTag );

//

//排序

GameObject[] fishOrderly = fishs.OrderBy( temp => temp.transform.GetSiblingIndex() ).ToArray();

Guess you like

Origin blog.csdn.net/qq_39162566/article/details/107795970