Baking the NavMesh at runtime?

First of all, I am using C#. I need a way, as the question states, to be able to bake the NavMesh (as you would do in the navigation window within the editor) but at runtime, after my level has been generated (which also generates NavMesh segments). I tried this out:

using UnityEngine;
using System.Collections;

public class BakeNavMeshOnStart : MonoBehaviour {
	public bool doneGenerating;

	void Start(){
		doneGenerating = false;

	void Update(){
		if (doneGenerating){


But apparently, that doesn’t work. I get this error on line 14:

Assets/Scripts/BakeNavMeshOnStart.cs(14,52): error CS0201: Only assignment, call, increment, decrement, and new object expressions can be used as a statement

If anybody could let me know how to fix this script, or let me know another way to bake navmesh at runtime, I would be extremely grateful. Thank you in advance for any help you offer!

(By the way, if you’re confused about the script, I have the doneGenerating variable changed from another script, so don’t worry)

the correct syntax would be NavMeshBuilder.BuildNavMesh(); but it’s editor only, not for runtime.