Files
project1_Space4x/Assets/BackButton.cs
2023-06-05 15:34:37 +02:00

21 lines
570 B
C#

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BackButton : MonoBehaviour
{
public GameObject[] objectsToDeactivate;
public GameObject[] objectsToActivate;
public void GoBack()
{
for (int i = 0; i < objectsToActivate.Length; i++)
{
objectsToActivate[i].SetActive(true); // activate the game object
}
for (int i = 0; i < objectsToDeactivate.Length; i++)
{
objectsToDeactivate[i].SetActive(false); // deactivate the game object
}
}
}