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. Dismiss Notice

Question OnTriggerExit help?

Discussion in 'Scripting' started by riasillo, Sep 4, 2023.

  1. riasillo

    riasillo

    Joined:
    May 23, 2023
    Posts:
    24
    I have a game object with a collider, trigger checked and rigid body. Parent to a game object with TMP component. Both are checked active. Parent game object has tag TextPopUp.
    Player capsule has a collider.
    script attached to player capsule
    debug shows enter and exit.

    On game start text is hidden.
    on enter, text appears as it should
    On exit it does not disappear?
    can't figure out why it won't work right.
    also tried gameObject.tag
    and OnTriggerStay added in, but works same.
    Any help appreciated.

    View attachment 1297938
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    36,749
    Read your second boolean carefully. :)

    Not false is true.

    For future reference:


    If you post a code snippet, ALWAYS USE CODE TAGS:

    How to use code tags: https://forum.unity.com/threads/using-code-tags-properly.143875/

    - Do not TALK about code without posting it.
    - Do NOT post unformatted code.
    - Do NOT retype code. Use copy/paste properly using code tags.
    - Do NOT post screenshots of code.
    - Do NOT post photographs of code.
    - ONLY post the relevant code, and then refer to it in your discussion.


    How to report your problem productively in the Unity3D forums:

    http://plbm.com/?p=220

    This is the bare minimum of information to report:

    - what you want
    - what you tried
    - what you expected to happen
    - what actually happened, log output, variable values, and especially any errors you see
    - links to documentation you used to cross-check your work (CRITICAL!!!)

    The purpose of YOU providing links is to make our job easier, while simultaneously showing us that you actually put effort into the process. If you haven't put effort into finding the documentation, why should we bother putting effort into replying?
     
  3. riasillo

    riasillo

    Joined:
    May 23, 2023
    Posts:
    24
    got it thanks. didn't see how to insert code like everyone does. I see the widget now. total noob,.appreciate it.
     
    Kurt-Dekker likes this.