Search Unity

Pathfinding Multiple Units - Optimization

Discussion in 'Scripting' started by kittik, Jul 4, 2018.

  1. kittik

    kittik

    Joined:
    Mar 6, 2015
    Posts:
    483
    When multiple RTS units are tasked with Pathfinding, then moving towards the destination node (if the destination is reachable), there is a noticeable lag. Each unit has its own Pathfinder script attached to it.

    I understand that I am probably computing too many complex tasks at once, creating the lag. Does anybody know if there is a way of being able to compute the tasks all at once (or at least, one after another), that prevents any lag from happening.

    I am using Hashsets and Dictionaries to hold important information in a more efficient manner.

    I would appreciate any feedback on how to best calculate paths without causing a computer to slow down.