Can see Object Performence

Shanmukh

Member
I am using 150 bots, they using can see Object task. it reducing performance a lot. "physics.overlapshrenonalloc" running too much. please optimize this script performance.
 
thank you.
but Can see Object is also called OverlapSphereNonAlloc. because I tested only with this task.
if I use the Within Distance task it calls Physics.OverlapSphere, and also getting GC Alloc. both are getting the nearly same performance cost.
because I am using it for Mobile.
 
What is the callstack that you see OverlapSphereNonAlloc being called for Can See Object? OverlapSphereNonAlloc is within MovementUtility.WithinHearingRange which is called by CanHearObject.

WithinDistance does call OverlapSphere if you are using the layer mask and I will change that in the next update to use the NonAlloc version.
 
What is the call stack that you are seeing for OverlapSphereNonAlloc with Can See Object?
 
sorry. I don't understand what you are asking.
do you mean returned Object ?. Return Object is Capsule Collider.
Wg Capture.JPG
 
No - the call stack of with the line numbers calling OverlapSphereNonAlloc from CanSeeObject. CanSeeObject has no path to OverlapSphereNonAlloc so I'm not sure what you are seeing.
 
Ahh, ok, I see. Makes sense now.

The tips within this post applies for that - there are a few ways that you can reduce the number of times or number of objects that are returned.
 
Top