Search Unity

Controller Time.timeScale bug FIX

Discussion in 'Daydream' started by wojwen, Aug 16, 2017.

  1. wojwen

    wojwen

    Guest

    Few days ago I posted a thread about this bug. It's about the controller not working properly when Time.timeScale is set to 0. The controller isn't visible if Time.timeScale i 0 from the start, it doesn't interact with UI and tooltips are invisible. I managed to fix this by making following changes:
    In GvrLaserVisual.cs replace
    Code (CSharp):
    1. return lerpSpeed > 0.0f ? lerpSpeed * Time.deltaTime : 1.0f;
    with
    Code (CSharp):
    1. return lerpSpeed > 0.0f ? lerpSpeed * Time.unscaledDeltaTime : 1.0f;
    In GvrControllerVisual.cs replace
    Code (CSharp):
    1. float deltaTime = Time.deltaTime;
    with
    Code (CSharp):
    1. float deltaTime = Time.unscaledDeltaTime;
    and in GvrArmModel.cs replace
    Code (CSharp):
    1. float animationDelta = DELTA_ALPHA * Time.deltaTime;
    with
    Code (CSharp):
    1. float animationDelta = DELTA_ALPHA * Time.unscaledDeltaTime;
    All I did was replacing Time.deltaTime with Time.unscaledDeltaTime. I already reported this on GitHub, but untill next update this is the solution.
     
  2. intruder_5

    intruder_5

    Joined:
    Mar 16, 2018
    Posts:
    3
    Did that!
    Still not working!!!!!
     
  3. unity_sLRJwYQ5Akgw9A

    unity_sLRJwYQ5Akgw9A

    Joined:
    Jun 12, 2018
    Posts:
    1
    I ran into a similar issue. The game would throw exceptions when I tried to move the pointer while Timescale was set to 0. After some digging, I found that it was probably caused by a divide by zero error in the bowels of the daydream framework. I "fixed" it by setting my timescale to a very small number, like 0.00001f. Slow enough that the game appears paused, but wont cause any divide by zero problems.