How would I be able to access this variable that is inside of a method from another script OR move it outside of the script (Since it seems to only work inside the script)
(The script that holds the variable)
public void SpawnRandomZombie()
{
//Here is the variable I'm trying to access from the other script. I would either
//want to access it from inside the script or move it outside the script which
//I dont know how to do
int rrifziNumber = RRIFZI();
if (detectCollisionsScript.gameOver != true)
{
Debug.Log("SpawnManager Script " + rrifziNumber);
Instantiate(zombiePrefabs[rrifziNumber], RandomSpawnPos(), zombiePrefabs[rrifziNumber].transform.rotation);
}
public int RRIFZI()
{
//RRIFZI Stands for ReturnRandomIntFromZombieIndex, Just an abbreviation so its shorter
int zombieIndex = Random.Range(0, zombiePrefabs.Length);
return zombieIndex;
}
(The script thats trying to access the variable above)
void ZombieStats()
{
//The rrifziNumber is giving me an error CS1061
Debug.Log("ZombieAI " + spawnManagerScript.rrifziNumber);
}