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

Show text by looking on a sign

Discussion in 'Scripting' started by mattukat2go, Aug 24, 2020.

  1. mattukat2go

    mattukat2go

    Joined:
    Aug 10, 2020
    Posts:
    33
    Hello,

    I'm looking for way to show text by posting with the mouse on a sign, like Firewatch does it.
    Has somebody an idea? My searches led sadly to nothing.
     
  2. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,144
    When you give a reference to a game, it's a good idea to also post a screenshot of what you mean. Don't assume others have played the game or even know what you are referencing.

    It doesn't sound complex, but I have never played Firewatch, so it could be simple or complex.
     
  3. mattukat2go

    mattukat2go

    Joined:
    Aug 10, 2020
    Posts:
    33
    True and thanks for the reminder. Please find attached the screen grab. When the mouse points to the sign it shows me the text.
     

    Attached Files:

  4. Brathnann

    Brathnann

    Joined:
    Aug 12, 2014
    Posts:
    7,144
    Most likely this is just a raycast/linecast with a set max distance so the user has to be close to it. When the raycast/linecast hits an object, you can code it to check for a script/interface/tag, something to indicate it has a text popup.

    Let's just say it's a script. That script may have a reference to the text itself or a way of pulling the text from elsewhere, but either way, you could just grab the script, call a method (DisplayPopupText() for example) which then populates the text and turns it on.

    Hopefully that gives you some idea of what to look into.
     
  5. mattukat2go

    mattukat2go

    Joined:
    Aug 10, 2020
    Posts:
    33
    Thanks for the reply! I dive into this!