Raycast Pixel and Image Hotspot - Unity [ENG]

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

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

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

    Thank you so much for the video! Quick question, what If I wanted to check and store a specific pixel then check that pixel again later to see if it changed from the original color? Without having to declare colors manually?

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

    Thank you for the video!
    I'm trying to do this with a sphere, but it's not working. I followed all the steps, but nothing happen. Do you know what needs to change to make it work with a sphere?

  • @shawnyification
    @shawnyification 7 лет назад

    can i use a raycast to change whatever image the ray hits to another image?

    • @KristerCederlund
      @KristerCederlund  7 лет назад

      +Shawn Harvey absolutely, change the material in the renderer.

    • @shawnyification
      @shawnyification 7 лет назад

      hello i got my ray cast working. however i'm wondering if i can use an image with a ray cast attached and have it hit an object with a public variable holding a image then pass that image to the image with my ray cast and assign it to its own image component. would this be a reliable and/or reusable code, and how should i go about approaching this ??

    • @KristerCederlund
      @KristerCederlund  7 лет назад +1

      Yes this should be doable. You need do do a GetComponent on the object you hit and retrieve the image and place it as the image on the object you raycast from.

    • @shawnyification
      @shawnyification 7 лет назад

      Thanks a lot

    • @shawnyification
      @shawnyification 7 лет назад

      finally got that one done but can you tell me what im doing wrong here. this code im attempting to have some what of an inventory list and i want as a item is added to the list the value of that item is added displaying a total. it works when i add a second item but it doesn't record the first one.
      Text putvalue;
      string somenewaddvalue;
      Text thistextcomponent;
      public float putithere;
      public float blahh;
      void Start ()
      {
      thistextcomponent = GetComponent();
      }
      public void Addingthetotalpercart()
      {
      Imagechildfixer b = GetComponentInParent();
      if (b != null)
      {
      putvalue = b.itemcost;
      somenewaddvalue = putvalue.text;
      blahh = float.Parse(somenewaddvalue);
      putithere += blahh;
      }
      }
      void Update ()
      {
      thistextcomponent.text = "Cart Total " + Math.Round(putithere, 2);

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

    01:45 Too bad I'm not supposed to open it with Rider

  • @wholebitmedia
    @wholebitmedia 5 лет назад

    texture not readable...:P

  • @personmuc943
    @personmuc943 7 лет назад

    I got -1 index!

    • @KristerCederlund
      @KristerCederlund  7 лет назад +1

      Check the color value you were looking for, it seems it isn't in the array of colors.

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

    preview is really bad

  • @KarinaFPV
    @KarinaFPV 4 года назад

    TNX!