Version: 2023.2
public void ToggleVisibility (GameObject gameObject, bool includeDescendants);

参数

gameObject 要切换可见性所在的 GameObject。
includeDescendants 是否包含后代。

描述

切换 GameObject 的可见状态。

当 includeDescendants 为 true 时,后代被设置为与父 GameObject 相同的可见状态。当 includeDescendants 为 false 时,后代的可见性状态不受影响。