I'm doing the hummingbird course and when I try to do the heuristic test I get the error pictured below: Object reference not set to an instance of an object in the OnEpisodeBegin function on line 76 which reads flowerArea.ResetFlowers(); (see HummingbirdAgent.cs). This makes no sense to me because flowerArea is declared above on line 34. Here's a picture of the error
Here's the OnEpisodeBegin() function
public override void OnEpisodeBegin()
{
if (trainingMode)
{
//Only reset flowers in training when there is one agent per area
flowerArea.ResetFlowers();
}
//Reset nectar obtained
NectarObtained = 0f;
// Zero out velocities so that movement stops before a new episode begins
rigidbody.velocity = Vector3.zero;
rigidbody.angularVelocity = Vector3.zero;
//Default to spawning in front of a flower
bool inFrontOfFlower = true;
if (trainingMode)
{
//Spawn in front of flower 50% of the time during training
inFrontOfFlower = UnityEngine.Random.value > .5f;
}
// Move the agent to a new random position
MoveToSafeRandomPosition(inFrontOfFlower);
// Recalculate the nearest flower now that the agent has moved
UpdateNearestFlower();
}
and here's the declaration on line 34:
private FlowerArea flowerArea;