I’m trying to get a battle ship to launch fighters. When I call my Launch Fighter function I get an error saying the variable has not been assigned. I did drag my prefab onto the variable “enemyFighter” in the inspector. Code Follows.
function LaunchFighters()
{
var fighters : int = GetComponent(EnemyShip).fightersDocked;
for(var q = 1; q < fighters; q++)
{
GameObject.Instantiate(enemyFighter, transform.position, transform.rotation);
Debug.Log("Fighter Deployed");
GetComponent(EnemyShip).fightersDocked = GetComponent(EnemyShip).fightersDocked - 1;
}
}