当前位置: 首页>>代码示例>>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;未经允许,请勿转载。