Hi, I was profiling my game today and I noticed that a lot of the CPU resources are tied up in KinematicObjectManager.FixedUpdate(), specifically on when Physics.SyncTransforms is called.

I was wondering, given the guidance here, would it be better to batch the Physics.SyncTransforms() once as opposed to calling it multiple times per character? The same applies to the call in KinematicObjectManager.BeginCharacterMoveInternal().
KinematicObjectManager.FixedUpdate()
Thanks!

I was wondering, given the guidance here, would it be better to batch the Physics.SyncTransforms() once as opposed to calling it multiple times per character? The same applies to the call in KinematicObjectManager.BeginCharacterMoveInternal().
KinematicObjectManager.FixedUpdate()
C#:
for (int i = 0; i < m_CharacterCount; ++i) {
if (m_Characters[i].CharacterLocomotion.UpdateLocation == UpdateLocation.Update) {
continue;
}
if (!m_AutoSyncTransforms) {
Physics.SyncTransforms();
}
m_Characters[i].Move(false);
if (m_Characters[i].CharacterIK != null && m_Characters[i].CharacterIK.enabled)
{
m_Characters[i].CharacterIK.Move(true);
}
// If FixedUpdate is called multiple times before Update then the framerate is low.
// Update the position immediately to prevent jittering.
if (m_FixedUpdate)
{
m_Characters[i].AssignFixedLocation(true);
}
}
C#:
/// <summary>
/// Internal method which indicates that the character has started moving.
/// </summary>
/// <param name="characterIndex">The index of the character within the characters array.</param>
private void BeginCharacterMovementInternal(int characterIndex)
{
if (characterIndex < 0) {
return;
}
if (!m_AutoSyncTransforms) {
Physics.SyncTransforms();
}
var updateLocation = m_Characters[characterIndex].CharacterLocomotion.UpdateLocation;
if (updateLocation == UpdateLocation.FixedUpdate) {
m_Characters[characterIndex].RestoreFixedLocation();
}
// If the character has a camera attached the camera should first be rotated.
int cameraIndex;
if (m_Characters[characterIndex].AttachedCamera != null && (cameraIndex = m_Characters[characterIndex].AttachedCamera.KinematicObjectIndex) >= 0) {
m_Cameras[cameraIndex].Rotate();
}
}
Thanks!