当前位置: 首页>>代码示例>>C#>>正文


C# GameObject.GetComponentsInImmediateChildren方法代码示例

本文整理汇总了C#中UnityEngine.GameObject.GetComponentsInImmediateChildren方法的典型用法代码示例。如果您正苦于以下问题:C# GameObject.GetComponentsInImmediateChildren方法的具体用法?C# GameObject.GetComponentsInImmediateChildren怎么用?C# GameObject.GetComponentsInImmediateChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在UnityEngine.GameObject的用法示例。


在下文中一共展示了GameObject.GetComponentsInImmediateChildren方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: InitializeSecondaryMeshes

 protected override void InitializeSecondaryMeshes(GameObject itemGo) {
     base.InitializeSecondaryMeshes(itemGo);
     _secondaryMeshRenderers = itemGo.GetComponentsInImmediateChildren<MeshRenderer>().Except(_primaryMeshRenderer);
     if (_secondaryMeshRenderers.Any()) {  // some planets may not have atmosphere or rings
         _secondaryMeshRenderers.ForAll(smr => {
             __ValidateAndCorrectMeshLayer(smr.gameObject);
             smr.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On;
             smr.receiveShadows = true;
             smr.enabled = false;
             // Note: using custom SpaceUnity Shaders for now
         });
     }
 }
开发者ID:Maxii,项目名称:CodeEnv.Master,代码行数:13,代码来源:PlanetDisplayManager.cs

示例2: InitializePrimaryMesh

        protected override MeshRenderer InitializePrimaryMesh(GameObject itemGo) {
            var meshRenderers = itemGo.GetComponentsInImmediateChildren<MeshRenderer>();
            var primaryMeshRenderer = meshRenderers.Single(mr => {

                Profiler.BeginSample("Editor-only GC allocation (GetComponent returns null)", (_trackedItem as Component).gameObject);
                var ir = mr.GetComponent<IRevolver>();
                Profiler.EndSample();

                if (ir != null) {
                    return true;
                }
                return false;
            });
            primaryMeshRenderer.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.On;
            primaryMeshRenderer.receiveShadows = true;
            __ValidateAndCorrectMeshLayer(primaryMeshRenderer.gameObject);
            // Note: using custom SpaceUnity Shaders for now
            return primaryMeshRenderer;
        }
开发者ID:Maxii,项目名称:CodeEnv.Master,代码行数:19,代码来源:PlanetDisplayManager.cs


注:本文中的UnityEngine.GameObject.GetComponentsInImmediateChildren方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。