Why I get this error " use of unassigned local variable" in my EnemySpawing?

using UnityEngine;
using System.Collections;

public class EnemySpawner : MonoBehaviour {

public GameObject EnemyGO;
private float maxSpawnRateInSeconds = 5f;

// Use this for initialization
void Start () 
{
	Invoke ("SpawnEnemy", maxSpawnRateInSeconds);
	
	InvokeRepeating("IncreaseSpawnRate", 0f, 30f);
}

// Update is called once per frame
void Update () 
{

}

void SpawnEnemy()
{
	Vector2 min = Camera.main.ViewportToWorldPoint (new Vector3 (0, 0));
	
	Vector2 max = Camera.main.ViewportToWorldPoint (new Vector2 (1, 1));
	
	GameObject anEnemy = (GameObject)Instantiate (EnemyGO);
	anEnemy.transform.position = new Vector2 (Random.Range (min.x, max.x), max.y);
	
	ScheduleNextEnemySpawn ();
}

void ScheduleNextEnemySpawn()
{
	float spawnInNSeconds;
	
	if(maxSpawnRateInSeconds > 1f)
	{
		maxSpawnRateInSeconds = Random.Range(1f, maxSpawnRateInSeconds);
	}
	else
		spawnInNSeconds = 1f;
	
	Invoke("SpawnEnemy", spawnInNSeconds);
}

void IncreaseSpawnRate()
{
	if(maxSpawnRateInSeconds > 1f)
		maxSpawnRateInSeconds--;
		
	if(maxSpawnRateInSeconds == 1f)
		CancelInvoke("IncreaseSpawnRate");	
}		

}

On line 32 you declare spawnInNSeconds with no default value. You set the value to 1 in the else on line 39, then use the variable on line 41. If maxSpawnRateInSeconds is greater than 1 then spawnInSeconds doesn’t get set to a value, so you get the error that you’re trying to use an uninitialized variable.

So you can either set a default value when you’re declaring the variable or set a value inside the if.