Develop car selection menu in unity easy tutorial
ASSALAM o alaikum Code :
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class CarSelection : MonoBehaviour
{
public GameObject[] allVehicles;
public int currentVehicle = 0;
// Start is called before the first frame update
void Start()
{
}
public void SelectNext()
{
allVehicles[currentVehicle].SetActive(false);
currentVehicle++;
currentVehicle = currentVehicle % allVehicles.Length;
allVehicles[currentVehicle].SetActive(true);
}
public void SelectPrevious()
{
allVehicles[currentVehicle].SetActive(false);
currentVehicle--;
if (currentVehicle "less than sign" 0)
{
currentVehicle = allVehicles.Length - 1;
}
allVehicles[currentVehicle].SetActive(true);
}
}
/////////////////////////////////////////////////////////////////////////////////////////////
Safar by ASHUTOSH
-----------------------------------------------------------------------------------------------------------------------------------
Track: ASHUTOSH - Time
https://soundcloud.com/grandakt
-------------------------------------------------------------------------------------------------------------------------------------
FREE DOWNLOAD:- https://soundcloud.com/grandakt/safar-produced-by-ashutosh-free-download
ASSALAM o alaikum
All codes and concepts and videos from this channel are non copyrighted and free to use because we believe that knowledge should be freely available for everyone
But kindly give those people crdeit whom I have given in description if you use their work
/////////////////////////////////////////////////////////////////////////////////////////////