playMaker

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

kavery

  • Full Member
  • ***
  • Posts: 149
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, 03:46:26 AM by jeanfabre »

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Re: Find Closest Game Object vs Get Closest In Array (performance)
« Reply #1 on: February 02, 2019, 12:00:40 PM »
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.