// Use this for initialization
        void Start()
        {
            character = GetComponent <CharacterController>();
            navMesh   = GameObject.FindObjectOfType <DungeonNavMesh>();
            if (navMesh == null)
            {
                Debug.LogWarning("Cannot build initialize dungeon navigation agent. No dungeon navigation object found in the scene. Drop in the DungeonNavigation prefab into the scene");
            }
            else
            {
                // Place the player on the nearest valid nav mesh polygon
                PositionOnNearestNavMesh();

                var agentParams = new SharpNav.Crowds.AgentParams();
                agentParams.Radius                = radius;
                agentParams.Height                = height;
                agentParams.MaxAcceleration       = maxAcceleration;
                agentParams.MaxSpeed              = maxSpeed;
                agentParams.CollisionQueryRange   = collisionQueryRange;
                agentParams.PathOptimizationRange = pathOptimizationRange;
                agentParams.SeparationWeight      = separationWeight;
                agentParams.UpdateFlags           = UpdateFlags.Separation | UpdateFlags.OptimizeTopo;

                var position  = transform.position;
                var sposition = ToSV3(position);
                if (navMesh.Crowd == null)
                {
                    Debug.Log("Navmesh not initialized properly.  Crowd is null");
                    return;
                }
                agentId = navMesh.Crowd.AddAgent(sposition, agentParams);

                if (agentId >= 0)
                {
                    agent = navMesh.Crowd.GetAgent(agentId);
                }
                else
                {
                    Debug.Log("Cannot create crowd nav agent");
                }
            }
        }