Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

OnTriggerEnter not working after the beta install

Discussion in '2019.3 Beta' started by estebaniakl, Aug 29, 2019.

  1. estebaniakl

    estebaniakl

    Joined:
    Jul 4, 2019
    Posts:
    5
    Hi guys, i have just updated Unity to the beta version and now two objects colliding in my 3D game dont trigger the OnTriggerEvent event.
    Before the update the game was working perfectly. I dont get what is happening!.
    All of my objects have the rigid body and box collider components attached. Is Trigger is on. All layers collide with all layers. I have restarted Unity and still cant get it to work. Can it be a bug on beta version?

    This is the code, but as i said earlier, this same code was perfectly working before the update:

    Code (CSharp):
    1. public void OnTriggerEnter(Collider other)
    2.     {
    3.         Debug.Log("colisioooon" + other.gameObject);
    4.         if (target && other.gameObject.GetInstanceID() == target.GetInstanceID())//if object is the target
    5.         {
    6.             isEngage = true;
    7.             agent.enabled = false;
    8.             obstacle.enabled = true;
    9.             //Debug.Log("trueman");
    10.         }
    11.     }
    Thank you guys for your help
     
  2. brunocoimbra

    brunocoimbra

    Joined:
    Sep 2, 2015
    Posts:
    679
  3. estebaniakl

    estebaniakl

    Joined:
    Jul 4, 2019
    Posts:
    5
    Thank you brunocoimbra.

    What i understand from that thread is that the trigger-trigger interactions in an Unity release in february were no longer supported. But until yesterday i was using 2019.3.0a8 and they worked perfectly, which means Unity released in between another version that supported again these interactions.
    Maybe now they are not supporting again trigger-trigger interactions? I read the features of the beta but didnt see anything of this (i could have skipped something maybe)

    In the thread mentioned they also say to use a workaround.
    If that is so, i will go to get a pillow and cry all night lying in my bed xD.

    Nevertheless, I will try reporting this as a bug.
     
  4. brunocoimbra

    brunocoimbra

    Joined:
    Sep 2, 2015
    Posts:
    679
    No, you misunderstood, trigger-trigger interactions were removed from PhysX 4.1, which is now shipped with Unity 2019.3, the release from February you saw was just a test version of the Physx 4.1.
     
  5. estebaniakl

    estebaniakl

    Joined:
    Jul 4, 2019
    Posts:
    5
    So, I should look for a workaround?
     
  6. estebaniakl

    estebaniakl

    Joined:
    Jul 4, 2019
    Posts:
    5
    I think I found a workaround. It wasnt that difficult after all. It is working fine until now, but without too much tests, and since im not an expert, im not quite sure the meaning of what im doing.

    If anyone cares, my game is a topup 2D game but developed in 3D (because of NavMesh functionality). To solve this Trigger-trigger issue, Im using OnCollideEnter instead of OnTriggerEnter. My objects have a rigidbody and a box collider. Of course "Is Trigger" is not ticked. In Rigidbody, I have "Is Kinematic" ON and "Use Gravity" OFF. This configuration is working for me.

    Bye
     
    brunocoimbra likes this.
  7. ToastedSoul

    ToastedSoul

    Joined:
    Jan 12, 2013
    Posts:
    1
    I've tried this in 2019.3.0b7, but I could not get it working. Only if one of my objects has a non-kinematic rigidbody attached (as described here https://docs.unity3d.com/ScriptReference/Collider.OnCollisionEnter.html), OnCollisionEnter gets called.

    To get Trigger-Trigger events easy, I had to duplicate the Collider on each GameObject and make sure that one of them had IsTrigger set and the other one not. OnTrigger gets then called on both.
     
  8. Becerrasdf

    Becerrasdf

    Joined:
    Jun 15, 2019
    Posts:
    1
    So this is why my on trigger enter events on Unity 2019.3.0a5 are not working at all?