What uses up performance while standing still?

With a 1000 units standing still I get the following, what is causing this and would writing my own movement script let me avoid this type of thing or is it part of the “base”?:

Hi

First off, it seems like you have 5000 agents, not 1000 (at least judging by your profiler data).
The movement scripts typically do not care much if they are standing still or moving, they run almost exactly the same code anyway. You can explicitly disable their movement code using the canMove property, but then you’ll also make sure to enable that when you want them to move again.
For 1000 agents you may have to write a custom movement script to get the performance you want. The built-in movement scripts are flexible, but as part of that flexibility they also trade off a bit of performance.

Nah there are 1001 exactly, I think it may be caused by the phsycis update settings in my project. Looks like fixed update is called 5 times in one frame, since each unit has a kinematic rigidbody.

Is there any example of writing a custom movement script without using the unity character controller?

Hi

Ah, what’s your fixed update frequency? Having 5 fixed updates per frame sounds like a lot. Though I suppose the frame takes a long time too.
The built-in movement scripts work just fine without a CharacterController. You can simply remove it. The fastest way is to not use a rigidbody nor a character controller. Then the script will fall back to just using the Transform.

default; 0.02f.

Yeah Im not using a character controller, I was wondering if there are any examples of writing custom movement scripts without a character controller (the one on your website has a character controller)

I need a rigidbody for collision detection unfortunately.

If you follow the tutorial (https://arongranberg.com/astar/docs/custom_movement_script.html) and check the descriptions for 2D you will get essentially that. It uses just a Transform component, no CharacterController

2 Likes