Unity Tutorial 04 - Showing Text on Trigger

Поделиться
HTML-код
  • Опубликовано: 19 дек 2024

Комментарии • 26

  • @sioswolff8896
    @sioswolff8896 3 года назад +4

    For anyone that tried this code but the text wouldnt appear even though there is no error, the fix is check if your First Person Controller has a tag of "Player" or not (top right corner of inspector). Hope this helps!

  • @RockDude65
    @RockDude65 3 года назад +3

    None of these trigger scripts on RUclips are working for me! Can you help? There are no compiling errors or anything, just the text not popping up

    • @jaioudev
      @jaioudev 3 года назад

      Same here

    • @jaioudev
      @jaioudev 3 года назад

      Btw do you already know the problem now?

    • @JacobJavor
      @JacobJavor 2 года назад

      FIGURED IT OUT. THIS IS WHAT YOU NEED TO DO:
      1. In your hierarchy, select your Canvas we made in this tutorial
      2. Go into the inspector, and find the Canvas panel within the Canvas
      3. Go to the Render Mode panel, and set it "Screen Space - Camera"
      4. In the same panel, set the Render Camera as your main player camera. In my case, it is found at XR Origin -> Camera Offset -> Main Camera. Just drag your Camera in your heirarchy directly into the Render Camera box.
      This should fix it. This will make the text display directly in the player's line of sight, and follow their head wherever they move it for 5 seconds.

  • @Dilithium1
    @Dilithium1 Год назад +1

    What changes do I need to make in order to have the text not destroy after the player steps in the trigger?

  • @waxocelot9395
    @waxocelot9395 2 года назад +1

    Hey, I have the code copied exactly, the collider on the box is labelled as a trigger, and i have the player set as a player tag, why isnt it showing up?

    • @JacobJavor
      @JacobJavor 2 года назад

      FIGURED IT OUT. THIS IS WHAT YOU NEED TO DO:
      1. In your hierarchy, select your Canvas we made in this tutorial
      2. Go into the inspector, and find the Canvas panel within the Canvas
      3. Go to the Render Mode panel, and set it "Screen Space - Camera"
      4. In the same panel, set the Render Camera as your main player camera. In my case, it is found at XR Origin -> Camera Offset -> Main Camera. Just drag your Camera in your heirarchy directly into the Render Camera box.
      This should fix it. This will make the text display directly in the player's line of sight, and follow their head wherever they move it for 5 seconds.

  • @JacobJavor
    @JacobJavor 2 года назад +3

    December 2022 - FIGURED IT OUT. THIS IS WHAT YOU NEED TO DO IF YOURS DOESN'T WORK:
    1. In your hierarchy, select your Canvas we made in this tutorial
    2. Go into the inspector, and find the Canvas panel within the Canvas
    3. Go to the Render Mode panel, and set it "Screen Space - Camera"
    4. In the same panel, set the Render Camera as your main player camera. In my case, it is found at XR Origin -> Camera Offset -> Main Camera. Just drag your Camera in your heirarchy directly into the Render Camera box.
    This should fix it. This will make the text display directly in the player's line of sight, and follow their head wherever they move it for 5 seconds.
    Also, if this doesn't work, as another comment said, make sure that your Player in your heirarchy is set to the "Player" tag. This is done in the inspector, top right, under "Layer". This is becuase the script you write in this tutorial only checks for collisions with objects that are tagged "Player" to trigger the text-showing event. Hope this helps!

    • @jonnyb.animationstutorials7119
      @jonnyb.animationstutorials7119 5 месяцев назад

      I'm getting an error. Something like script class can't be found, when I try to add it to a cube, it says it can't because script class can't be found. What does that mean?

  • @jaioudev
    @jaioudev 3 года назад +1

    Even though i put the code right and insert the text into the code, why the text doesn't pop up? I hope you can reply, thank you!

    • @shang_psycho7414
      @shang_psycho7414 2 года назад

      There's a comment that says this: For anyone that tried this code but the text wouldnt appear even though there is no error, the fix is check if your First Person Controller has a tag of "Player" or not (top right corner of inspector). Hope this helps!

    • @JacobJavor
      @JacobJavor 2 года назад

      FIGURED IT OUT. THIS IS WHAT YOU NEED TO DO:
      1. In your hierarchy, select your Canvas we made in this tutorial
      2. Go into the inspector, and find the Canvas panel within the Canvas
      3. Go to the Render Mode panel, and set it "Screen Space - Camera"
      4. In the same panel, set the Render Camera as your main player camera. In my case, it is found at XR Origin -> Camera Offset -> Main Camera. Just drag your Camera in your heirarchy directly into the Render Camera box.
      This should fix it. This will make the text display directly in the player's line of sight, and follow their head wherever they move it for 5 seconds.

  • @wicksley
    @wicksley Год назад

    Thank you for this very helpful video and script :D

  • @musawenkosisangweni3689
    @musawenkosisangweni3689 2 года назад

    Hi
    How do I stop the text from following the player?

    • @Dilithium1
      @Dilithium1 Год назад

      If you want your text to stay in a certain location, don’t use a canvas and just add the text and you can move it to where you want it.

  • @radhikajain15
    @radhikajain15 Год назад

    Thank you so much! Super helpful :)

  • @celestefinazzi
    @celestefinazzi Год назад

    very nice tutorial thank amar:D

  • @rohan4556
    @rohan4556 3 года назад

    Can you tell how can I display the text everytime I enter the area ? I don't want it to disappear after displaying once

    • @kiazr8418
      @kiazr8418 3 года назад

      just dont have destroy gameobject and waitforseconds

    • @kiazr8418
      @kiazr8418 3 года назад

      so that means you wont need to do the ienumorator and the last part of the void on trigger enter

    • @JacobJavor
      @JacobJavor 2 года назад

      delete the last 2 lines of his code and replace it with uiObject.SetActive(false);
      you only write this once. so it's supposed to be:
      IEnumerator WaitForSec()
      {
      yield return new WaitForSeconds(5);
      uiObject.SetActive(false);
      }
      }

  • @brookefeely3684
    @brookefeely3684 Год назад

    You are a LEGEND THANK YOU

  • @blindiversion923
    @blindiversion923 3 года назад

    Very helpful, thank you so much !

  • @ateneaespuna5462
    @ateneaespuna5462 3 года назад

    Thank you

  • @choco5947
    @choco5947 Год назад

    please i beg get a mic