當前位置: 首頁>>代碼示例>>C#>>正文


C# Component.GetComponentsInChildren方法代碼示例

本文整理匯總了C#中UnityEngine.Component.GetComponentsInChildren方法的典型用法代碼示例。如果您正苦於以下問題:C# Component.GetComponentsInChildren方法的具體用法?C# Component.GetComponentsInChildren怎麽用?C# Component.GetComponentsInChildren使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在UnityEngine.Component的用法示例。


在下文中一共展示了Component.GetComponentsInChildren方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: NotifyStencilStateChanged

 /// <summary>
 /// 
 /// <para>
 /// Notify all IMaskable under the given component that they need to recalculate masking.
 /// </para>
 /// 
 /// </summary>
 /// <param name="mask"/>
 public static void NotifyStencilStateChanged(Component mask)
 {
   List<Component> list = ListPool<Component>.Get();
   mask.GetComponentsInChildren<Component>(list);
   for (int index = 0; index < list.Count; ++index)
   {
     if (!((Object) list[index] == (Object) null) && !((Object) list[index].gameObject == (Object) mask.gameObject))
     {
       IMaskable maskable = list[index] as IMaskable;
       if (maskable != null)
         maskable.RecalculateMasking();
     }
   }
   ListPool<Component>.Release(list);
 }
開發者ID:NetherDrk,項目名稱:Eternal-Empire,代碼行數:23,代碼來源:MaskUtilities.cs

示例2: UIItem

            /**
             * empty slot constructor
             */
            public UIItem(Component itemElem)
            {
                Text TG = null, TK = null, TT = null, TN = null;
                foreach (Text t in itemElem.GetComponentsInChildren<Text>())
                {
                    if (t.name.Equals("Text_G"))
                        TG = t;
                    else if (t.name.Equals("Text_K"))
                        TK = t;
                    else if (t.name.Equals("Text_T"))
                        TT = t;
                    else if (t.name.Equals("Text_N"))
                        TN = t;
                }

                _itemElem = itemElem;
                _itemElemBorderImage = itemElem.GetComponent<Image>();
                _origColor = _itemElemBorderImage.color;
                _but = itemElem.GetComponent<Button>();
                _value = new UICurrency(TG, TK, TT, TN);
            }
開發者ID:Xentrics,項目名稱:Praecapatus,代碼行數:24,代碼來源:ShopManager.cs

示例3: NotifyStencilStateChanged

 public static void NotifyStencilStateChanged(Component mask)
 {
     List<Component> results = ListPool<Component>.Get();
     mask.GetComponentsInChildren<Component>(results);
     for (int i = 0; i < results.Count; i++)
     {
         if ((results[i] != null) && (results[i].gameObject != mask.gameObject))
         {
             IMaskable maskable = results[i] as IMaskable;
             if (maskable != null)
             {
                 maskable.RecalculateMasking();
             }
         }
     }
     ListPool<Component>.Release(results);
 }
開發者ID:randomize,項目名稱:VimConfig,代碼行數:17,代碼來源:MaskUtilities.cs

示例4: FindDependency

 public override object FindDependency(Component comp, FieldInfo field)
 {
     if (SearchParents) {
         comp = comp.transform.root;
     }
     if (IsContainerType(field)) {
         Type type;
         if (field.FieldType.IsArray) {
             type = field.FieldType.GetElementType();
         } else if (typeof(IList).IsAssignableFrom(field.FieldType)) {
             if (field.FieldType.GetGenericArguments().Length >= 1) {
                 type = field.FieldType.GetGenericArguments()[0];
             } else {
                 Debug.LogError(string.Format("{0} expected at least one generic argument from the type {1}, use List<T>", this, field.FieldType));
                 return null;
             }
         } else {
             Debug.LogError("Shouldn't be here");
             type = null;
         }
         if (Recursive) {
             return CreateArrayOrList(field, ConvertToGOArray(comp.GetComponentsInChildren(type, IncludeInactive)));
         }
         return CreateArrayOrList(field, ConvertToGOArray(comp.GetComponents(type)));
     }
     if (Recursive) {
         return comp.GetComponentInChildren(field.FieldType);
     }
     return comp.GetComponent(field.FieldType);
 }
開發者ID:paulmoore,項目名稱:UnJect,代碼行數:30,代碼來源:Attributes.cs


注:本文中的UnityEngine.Component.GetComponentsInChildren方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。