Since upgrading to 1.0 i am having trouble with Havok, it causes constant lag spikes even on empty worlds. Unity Physics runs fine, is there anything that i am missing? my other systems it seems to hang on are not doing anything Just this (but there are no entities to run it on) Entities.WithoutBurst().ForEach((Entity entity, ref ECSCollisionComponentData collision, in PhysicsVelocity velocity, in LocalTransform translation) => Thanks!
Can someone please explain why havok does not work properly in 1.0? Even in the main menu scene with nothing on it drags the framerate down to 2fps
Hi @argibaltzi ! Thanks for reporting this issue. Could you try the same again after removing the "WithoutBurst()" function call, please?
Yeah that is definitely unusual. Would you mind providing us with your project so that we can reproduce this? I assume it's not just a default, empty project but you have some systems in there that might be running here which could somehow be related to this slowdown. I tried reproducing in an empty project and the issue you are describing did not reproduce.
Havok seems to have problem with every system i have in the physics groups, even if they are bursted. I commend out 1 system as a test and it then it finds another one to hang one. Code (CSharp): [RequireMatchingQueriesForUpdate] [UpdateInGroup(typeof(BeforePhysicsSystemGroup))] [UpdateAfter(typeof(ConvertWheelJointsSystem))] [UpdateBefore(typeof(BuildPhysicsWorld))] public partial class WheelMotorSystem : SystemBase { protected override void OnUpdate() { FixedStepSimulationSystemGroup FixedStepSimulation = World.GetExistingSystemManaged<FixedStepSimulationSystemGroup>(); float delta = FixedStepSimulation.Timestep; EntityCommandBuffer frameCmd = new EntityCommandBuffer(Allocator.Temp, PlaybackPolicy.SinglePlayback); Entities.WithBurst().ForEach((ref ECSWheelMotorComponentData convertJoint, ref PhysicsVelocity velocity, in PhysicsMass mass, in Entity entity) => { velocity.ApplyAngularImpulse(in mass, convertJoint.TorquePerSecond); velocity.Linear += new float3(0, convertJoint.DownwardForce * delta, 0); //velocity.Angular += convertJoint.TorquePerSecond * delta; }).Run(); frameCmd.Playback(World.EntityManager); frameCmd.Dispose(); } } It now hangs on this tiny system which is also bursted
https://we.tl/t-0sW0VXmpVO This is a simple project where HAVOK constantly spikes in the profiler, its almost as if by design....... Unity 2022.2.0 I even saw a job in the presentation system waiting for havok
While we are investigating the issue, feel free to disable multi threading in the Physics Step component, which eliminates the staggering.
I have managed to repro the issue and number of threads is causing it. The easiest way to workaround the issue is to set JobsUtility.JobWorkerCount to smaller value than default (number of logical cores - 1). So in the attached repro it is enough to add code below into DotsTest1System class. Code (CSharp): protected override void OnCreate() { Unity.Jobs.LowLevel.Unsafe.JobsUtility.JobWorkerCount = 7; } This will limit number of job worker threads on the app level. Reducing the number of job worker threads just for Havok requires editing Havok Physics package which is more cumbersome process.
Ok gyes thank you, will try the fix and keep you posted. I used havok extensively in the 0.50 era and never had a problem with it.
Unity.Jobs.LowLevel.Unsafe.JobsUtility.JobWorkerCount = 7; works on my computer but what about other computers? whats the best way to write this? and obviously this is not an ideal solution..... neither is disabling multithreading I have 6 cores and 12 threads my default JobsUtility.JobWorkerCount was 11 When can we expect a proper fix in the package?
@argibaltzi: We totally agree that this is not ideal. This suggestion serves just as a temporary workaround to unblock you immediately. We have filed a ticket for this issue internally and are working on a solution. Once we have a better understanding of the timeline for the fix, we will report back to you. Stay tuned!
@argibaltzi : Good news! We have made a fix for this issue which will be added to the next pre-release of 1.0.
@argibaltzi : it's out now. https://forum.unity.com/threads/new...-release-now-available-february-2023.1400887/