本文整理汇总了C#中Component.GetComponentsInChildren方法的典型用法代码示例。如果您正苦于以下问题:C# Component.GetComponentsInChildren方法的具体用法?C# Component.GetComponentsInChildren怎么用?C# Component.GetComponentsInChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Component
的用法示例。
在下文中一共展示了Component.GetComponentsInChildren方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Notify2DMaskStateChanged
public static void Notify2DMaskStateChanged(Component mask)
{
var components = ListPool<Component>.Get();
mask.GetComponentsInChildren(components);
for (var i = 0; i < components.Count; i++)
{
if (components[i] == null || components[i].gameObject == mask.gameObject)
continue;
var toNotify = components[i] as IClippable;
if (toNotify != null)
toNotify.RecalculateClipping();
}
ListPool<Component>.Release(components);
}
示例2: NotifyStencilStateChanged
/// <summary>
/// <para>Notify all IMaskable under the given component that they need to recalculate masking.</para>
/// </summary>
/// <param name="mask"></param>
public static void NotifyStencilStateChanged(Component mask)
{
List<Component> componentList = ListPool<Component>.Get();
mask.GetComponentsInChildren<Component>(componentList);
for (int index = 0; index < componentList.Count; ++index)
{
if (!((Object) componentList[index] == (Object) null) && !((Object) componentList[index].gameObject == (Object) mask.gameObject))
{
IMaskable maskable = componentList[index] as IMaskable;
if (maskable != null)
maskable.RecalculateMasking();
}
}
ListPool<Component>.Release(componentList);
}