Search Unity

OnTriggerEnter Problem Unity 5.1.3f1x

Discussion in 'Physics' started by TESTIFICAT, Aug 28, 2015.

  1. TESTIFICAT

    TESTIFICAT

    Joined:
    Aug 25, 2015
    Posts:
    3
    While doing the first tutorial, I found the following problem: onTriggerEnter would not recognize a game.object entering a trigger. The pickups have this exact tag, are triggers, and have Rigidbodies(to allow them to become dynamic objects). The sphere has a Rigidbody and Sphere Collider, and the script is attached to the sphere. I tried reinstalling Unity, but it did not help.
    My code: (This is C#)

    void onTriggerEnter(Collider other)
    { Debug.Log ("Triggered c");

    if (other.gameObject.CompareTag ("Pick up"))
    { other.gameObject.SetActive (false);

    Debug.Log ("Triggered d"); } }

    I also put Logs earlier in the script, in void.Start and void.Update, and they work fine. The debugs in this snippet don't, however. I used the exact same script as in the tutorial, with the exception of various strings, which are irrelevant. Finally, there are no errors in the Console. I searched for other with this problem, but only found one, whose advice did not work in my case.
     
  2. DenisLemos

    DenisLemos

    Joined:
    May 1, 2015
    Posts:
    788
    Is OnTriggerEnter and not onTriggerEnter.
     
  3. TESTIFICAT

    TESTIFICAT

    Joined:
    Aug 25, 2015
    Posts:
    3
    Yes, look at the script.
     
  4. TESTIFICAT

    TESTIFICAT

    Joined:
    Aug 25, 2015
    Posts:
    3
    Problem solved, misunderstood your explanation _7stars.