using System; using System.Collections; using System.Collections.Generic; using UnityEngine; public class ClearArrayText : MonoBehaviour { // Use this for initialization void Start () { int[] intArray = new int[] { 1, 5, 9, 4 }; Array.Clear(intArray, 0, intArray.Length);//清空第0到第intArray.Length个索引的元素.(包括第0个,不包括第intArray.Length个) foreach (var item in intArray) { Debug.Log(item); } } }