Search Unity

Question Collider triggers stopped working when I went from 2021.3.26 -> 2022.3.0

Discussion in 'Physics' started by dcdemars, Jun 2, 2023.

  1. dcdemars

    dcdemars

    Joined:
    May 18, 2012
    Posts:
    22
    Anybody have this happen to them? Seeing that 2022 went to LTS status today I tried updating a project from 2021 version to 2022. Most things seem to be working except OnTriggerEnter doesn't seem to be called.

    Obviously since this has been working for years with older versions of Unity. I have a moving object with a capsule collider, a RigidBody component set isKinematic, and an OnTriggerEnter handler defined on one of its components. The 'isTrigger' flag is set on the collider. The other objects have capsule collider or box collider.

    Everything is on the default layer and anyway collisions are enabled between all layers in the Physics settings.

    OnTriggerEnter never gets called. Is there some new global setting that could be causing this?
     
  2. dcdemars

    dcdemars

    Joined:
    May 18, 2012
    Posts:
    22
    OK, I figured out the problem. I guess since I didn't find anything when I did a search that other people haven't had this problem.

    To figure it out I created a new project with 2022.3 and created a simple scene with two cubes colliding and confirmed that I got the OnTriggerEnter event.

    Then I exported that scene into the project I updated from 2021.3 and tried it again. The trigger no longer happened.

    This told me that the problem almost had to be a project setting so I compared the physics settings in the two projects.

    It turned out the problem was the "Simulation Mode" setting. This did not exist in 2021.3; that just had an "AutoSimulation" flag which is almost always turned on since otherwise you have to force all physics updates manually.

    The new setting has three modes defined, "Fixed Update", "Update" and "Script". I assume that AutoSimulation being turned on in the old version corresponds to "Fixed Update" and AutoSimulation off corresponds to "Script."

    In my updated project the mode was set to "Script." When I changed it to "Fixed Update" everything worked again.

    Hope that is helpful to anyone encountering this problem. I assume in most cases this setting gets set to the right thing.
     
    Last edited: Jun 2, 2023
  3. mentalup

    mentalup

    Joined:
    Dec 14, 2017
    Posts:
    7
    We got the same problem and our physic games broken with the 2022.2.20 builds and your solution didn't help us because it was already "Fixed Update" mode, upgrading to 2022.3.2f1 solved our problem.
     
  4. DrewofDonuts

    DrewofDonuts

    Joined:
    Apr 23, 2020
    Posts:
    28
    Hi, from the future. This friggin saved me...no idea how that setting switched. I was already on 2022, and made no (intentional) changes.