Question by
aidangig56 · May 31, 2018 at 02:23 AM ·
findobjectsoftype
Unity FindObjectsOfType ruining my performance?
I am having an issue with my script. It is causing my game to run poorly considering FindObjectsOfType call is causing over 60+% of my CPU alone. Take a look at the image. I will attach my script. The profiler says it is coming from RoomController.Update(). However, FindObjectsOfType is not listed in update scope at all. Please help me
Link to code - https://pastebin.com/hcc33qv6
cpu-usage.png
(116.6 kB)
Comment
Hello @aidangig56, I was curious how you were able to fix this. We're running into this issue and we have some deadlines coming up! Any help you can provide would be amazing!
Your answer
![](https://koobas.hobune.stream/wayback/20220612163741im_/https://answers.unity.com/themes/thub/images/avi.jpg)