Search Unity

Most efficient "find" operation.

Discussion in 'Editor & General Support' started by Wowmaniac, Jul 24, 2014.

  1. Wowmaniac

    Wowmaniac

    Joined:
    Jun 27, 2014
    Posts:
    4
    I'm creating a traffic simulation type program, and I'm trying to determine what would be the most cost efficient method of calculating a route using waypoints. The catch is that the user must be able to place/build the road system. The pathfinding must be able to compare many positions and distances/angles efficiently, but there will be time for coroutine/delay while the route is being calculated.

    I've narrowed down my options to either overlapsphere, raycast "scanning" , or findobjectswithtag. If there are no better options, which of these would be considered to be the best in terms of efficiency?

    Edit:

    I should mention that I plan to use layers and tags to determine which waypoints are "suitable progress", and I'm only wondering about the efficiency of "getting" the point data.
     
    Last edited: Jul 24, 2014
  2. Rene-Damm

    Rene-Damm

    Joined:
    Sep 15, 2012
    Posts:
    1,779
    Re FindObjectsWithTag: this operation is slow (it's not table-based; it will walk through all tagged objects for every search).