Making an iOS game.
Can I use GameObject.FindGameObjectsWithTag inside a function Update, or is it that cpu intensive that it will chew my fps and/or decrease the battery levels too fast?
Answer by azzogat
Jan 16, 2011 at 10:32 AM
It shouldn't ruin your performance, no. Unlike FindGameObjectWithName, FindGameObjectsWithTag looks through your tags first (which shouldn't be that many) and then returns all said objects. We're using it and we're not seeing any significant drawbacks.
That being said, if there's a way to do it that doesn't involve the update function you should probably do that instead.
Ahh of course, it would check just my Tags list, so it shouldn't be that much of a burden for the cpu. I'm actually using it in other functions called at certain moments but I'm having some minor problems and just wanted to know if function Update could be an alternative. Thanks azzogat!
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
No one has followed this question yet.
Reduce battery consumption as much as possible
Counting iphone FPS
Save battery on mobile
if I lock iPhone fps to 24fps, can I get more accurate touch timings than that?
Set fps from default 30 to 60 on iOS and Unity 3.5.3?