Search Unity

Question Speed Up Enemy Using Nav Mesh

Discussion in 'Navigation' started by BasiCubes, Jun 6, 2023.

  1. BasiCubes

    BasiCubes

    Joined:
    May 19, 2023
    Posts:
    2
    I am working on my game, and I need to speed up the enemy. I am using a nav mesh.


    void Update()
    {
    enemy.SetDestination(player.position);
    }
     
  2. Inxentas

    Inxentas

    Joined:
    Jan 15, 2020
    Posts:
    278
    Is enemy a NavMeshAgent? Then all you need to do is change it's speed value. You can modify the variables of a NavMeshAgent at runtime using script.
    Code (CSharp):
    1. enemy.speed = 4.5f;