Version: 2017.1

HideFlags.HideInHierarchy

切换到手册

描述

该对象不会显示在层级视图中。

using UnityEngine;
using System.Collections;

public class ExampleClass : MonoBehaviour { void Start() { int i = 0; while (i < 5) { GameObject createdGO = GameObject.CreatePrimitive(PrimitiveType.Plane); createdGO.hideFlags = HideFlags.HideInHierarchy; i++; } } }