using UnityEngine;

using System.Collections;


public class Chap10_8 : MonoBehaviour {

public GameObject[] cubes;

Stack stack = new Stack();

// Use this for initialization

void Start () {

for(int i = 0; i < 5; i++)

stack.Push(cubes[i]);

}

// Update is called once per frame

void Update () {

if(Input.GetKeyDown(KeyCode.Space)){

Destroy(stack.Pop() as GameObject);

}

}

}






+ Recent posts