I have 7 game objects or more. I want to run only one gameObject after the other. Starting with Gameobject 0 --> GameObject 1 --> GameObject 2. At the moment my script activates a new object each time Space is pressed, and the old ones are not deactivated.
Thanks for your help!
using UnityEngine;
using System.Collections;
using System.Collections.Generic;
public class ToggleTest : MonoBehaviour
{
public GameObject[] objects;
public int objCount = 0;
void Update()
{
if (Input.GetKeyDown(KeyCode.Space))
{
objCount += 1;
objects[objCount].SetActive(true);
}
}
}