playMaker

Author Topic: Find Closest Game Object vs Get Closest In Array (performance[SOLVED]  (Read 113 times)

kavery

  • Full Member
  • ***
  • Posts: 109
    • View Profile
Is it faster to use get closest within an array vs finding by tag? If so is it significantly different in overhead?

Thanks   8)
« Last Edit: February 04, 2019, 01:46:26 AM by jeanfabre »

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 691
    • View Profile
Re: Find Closest Game Object vs Get Closest In Array (performance)
« Reply #1 on: February 02, 2019, 10:00:40 AM »
Finding it from an array will always be faster, because its a smaller pool of objects to search through. However, depending on how often you are doing the task, it may not be an issue. Its not something you want to do everyframe however.

How fast or slow depends on how many gameobjects you have in the scene. Find by tag is not as bad as find gameobject by name. Which tends to be the worst.