void ExcludeFromParent(Transform t, List <Renderer> renderers) { Transform parentT = t.parent; CubeColorLocalSpaceRoot parentComponent = null; while (parentT != null) { parentComponent = parentT.GetComponent <CubeColorLocalSpaceRoot>(); if (parentComponent != null) { parentComponent.ExcludeRenderers(renderers); } parentT = parentT.parent; } }
void TransferToParent(Transform t, List <Renderer> renderers) { Transform parentT = t.parent; CubeColorLocalSpaceRoot parentComponent = null; while (parentT != null && parentComponent == null) { parentComponent = parentT.GetComponent <CubeColorLocalSpaceRoot>(); parentComponent = parentComponent != null && parentComponent.enabled ? parentComponent : null; parentT = parentT.parent; } if (parentComponent != null && parentComponent.IncludeRenderers(renderers)) { ; } else { UseGlobaSpace(renderers); } }