2025-04-17 13:18:45 +08:00

34 lines
642 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class SetFalse : MonoBehaviour
{
public Transform[] hiddenChildren;
[ContextMenu("隐藏")]
// Start is called before the first frame update
void Setttt()
{
HideChildrenRecursively(transform);
}
void Start()
{
}
void HideChildrenRecursively(Transform parent)
{
foreach (Transform child in parent)
{
// 隐藏当前子物体
child.gameObject.SetActive(true);
// 递归调用以处理子物体的子物体
HideChildrenRecursively(child);
}
}
}