public Transform GetTransformFromCandidates(string[] names) { if (DictObjName == null) { return(null); } var list = names.Where(name => DictObjName.ContainsKey(name)).Select(name => DictObjName[name].transform).ToArray(); return(list.Length <= 0 ? null : list.First()); }
private void FindAll(Transform trf) { if (!DictObjName.ContainsKey(trf.name)) { DictObjName[trf.name] = trf.gameObject; } var tag = trf.tag; if (string.Empty != tag) { if (!DictTagName.TryGetValue(tag, out var list)) { list = new List <GameObject>(); DictTagName[tag] = list; } list.Add(trf.gameObject); } for (var i = 0; i < trf.childCount; i++) { FindAll(trf.GetChild(i)); } }