Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

OnTriggerEnter Not Working with timeScale of 0

Discussion in 'Editor & General Support' started by philyum, Apr 10, 2014.

  1. philyum

    philyum

    Joined:
    Dec 16, 2013
    Posts:
    12
    I made a UI system that works with Box Colliders set as Triggers. Problem is, the colliders won't work when timeScale is set to zero. Any suggestions?
     
  2. StarManta

    StarManta

    Joined:
    Oct 23, 2006
    Posts:
    8,742
    I believe physics must be running in order for triggers to be detected, and if timeScale is 0, then no physics "frame" will ever be run. I bet that's what's going on.

    I'd recommend a non-trigger-based approach for those things, if possible, using Physics.OverlapSphere and similar functions. Alternately, maybe set your timescale to something like 0.001 (and your physics timestep to 0.0001?) when you're checking those things.
     
  3. philyum

    philyum

    Joined:
    Dec 16, 2013
    Posts:
    12
    Thanks I got it working now, using your suggested timeScale and fixedDeltaTime values.
    I then used a constant 0.02f for updates that should work independant of timescale.