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

As of version 3.5, OnTriggerExit has pretty much ceased working

Discussion in 'Scripting' started by generalmcmutton, Aug 7, 2013.

  1. generalmcmutton

    generalmcmutton

    Joined:
    May 20, 2010
    Posts:
    42
    Evening everyone.

    I had been working on a game project for quite a bit using Unity 3.4, and a lot of the stuff I had going used OnTriggerExit. Unfortunately, I made the mistake of updating Unity without backing everything up, and now OnTriggerExit has ceased working completely.

    It's literally never being read, so a lot of stuff that worked just fine before the upgrade is broken, which is incredibly annoying, as you might imagine.

    Was something changed that requires a different code syntax? I'm using UnityScript, and most of the calls look like this:

    Code (csharp):
    1. if OnTriggerExit (other : Collider) {
    2.     if(other.gameObject.tag == "Player/Enemy/whatever")
    3.          do stuff
    4. }
    If that's not the case, and it is completely broken in 3.5, has this been fixed in future versions? I'd rather not attempt to find out, only to have everything else break, which usually happens.

    If neither of those, what then? How can I fix this?
     
    Last edited: Aug 7, 2013
  2. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    Thats TriggerEnter

    *snigger*

    Doubt anything changed between those two versions around collisions.

    Try creating a new test scene with a very basic setup and see if the problem persists. Scenes can become corrupted without showing any obvious signs they are in fact corrupt.
     
  3. wolvz38

    wolvz38

    Joined:
    Feb 6, 2013
    Posts:
    66
  4. generalmcmutton

    generalmcmutton

    Joined:
    May 20, 2010
    Posts:
    42
    Whoops again; I also do that, I just mistyped.

    I tried making a fresh scene, as James suggested, and it appears to have worked. Since that's the case, I assume I'll just have to delete the problem objects, and recreate them from scratch?
     
  5. JamesLeeNZ

    JamesLeeNZ

    Joined:
    Nov 15, 2011
    Posts:
    5,616
    Hard to say for certain... depends whats causing the problem... check your collision layer's, rigidbody settings, etc