- Home /
Question by
MolhamM · Jul 11, 2019 at 09:48 AM ·
preformance
What's better for preformance .. script handling multi objects or each script handel it's object
So , I was trying to do some outline for objects when I hover on them ,
however I was stuck at something I can do a script that has Update function and checks If the ray collided with object then I can outline it , the second method to add script to all the objects and they wont have update function they will have OnMouseDown , OnMouseExit , As I understand the OnMouseDown and OnMouseExit is better that update that works all the time , is that ture ? , Like what will be the best performance to achieve this ?
Comment
Answer by pmerilainen · Jul 11, 2019 at 09:52 AM
it depends a lot of on the scene complexity, but I think OnMousexxx will give more predictable performance. It is linear to amount of objects receiving the events.
Your answer
![](https://koobas.hobune.stream/wayback/20220612204716im_/https://answers.unity.com/themes/thub/images/avi.jpg)