Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bug / Crash  Bug/Crash when setting timescale to 0 in lateupdate
#3
Hi there,

Here's the fix. Replace ObiSolver.cs' LateUpdate method with this one:

Code:
private void LateUpdate(){

        float lateUpdateDelta = 0;

        if (Application.isPlaying && simulationOrder == SimulationOrder.LateUpdate){

             if (Time.deltaTime > 0){

                 // smooth out timestep and accumulate it:
                 lateUpdateDelta = smoothDelta = Mathf.Lerp(Time.deltaTime,smoothDelta,0.95f);

                 AccumulateSimulationTime(lateUpdateDelta);
                 SimulateStep(lateUpdateDelta);

             }else{
                lateUpdateDelta = 0;
             }

        }

        if (!Application.isPlaying)
            return;
  
        EndFrame (simulationOrder == SimulationOrder.LateUpdate ? lateUpdateDelta : Time.fixedDeltaTime);

        if (OnFrameEnd != null)
            OnFrameEnd(this,null);
    }
Reply


Messages In This Thread
RE: Bug/Crash when setting timescale to 0 in lateupdate - by josemendez - 05-05-2018, 12:56 PM