老师,有个问题,children[i]不是返回的游戏物体么,为什么if判断的时候是 if (children[i] != transform),而不是 if (children[i] != Learn),我不明白transform是游戏物体里面的组件啊
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class Leran04_for_while : MonoBehaviour {
// Use this for initialization
void Start () {
Transform[] children = transform.GetComponentsInChildren<Transform>();
for (int i = 0; i < children.Length; i++)
{
if (children[i] != transform) {
GameObject.Destroy(children[i].gameObject);
}
}
}
// Update is called once per frame
void Update () {
}
}