Setting material of clicked object

Forums 💬 FlowCanvas ⚙️ Support Setting material of clicked object

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #22466
    immortalx
    Participant

      Is there a more elegant way to do this?
      get renderer

      It works OK, but I couldn’t find another way to extract the gameobject from a UI Pointer event.
      This flowchart is attached to an empty gameobject and (among other stuff) highlights whatever object is clicked by assigning a different material.

      #22470
      Gavalakis
      Keymaster

        Hey,

        There is an included Event that you can use for this, called “Mouse Pick” and found under “Events/Input” subcategory.

        [attachment file=”MousePickEvent.png”]

        The Flow output is called whenever the player clicks the mouse on some collider in the scene (you can also set a LayerMask in the node’s inspector) and the Pick Info output is a RaycastHit type containing the info.

        Let me know if that works for you.
        Thanks.

        #22469
        immortalx
        Participant

          Thanks a lot, I wasn’t aware of this event!

          BTW, i believe i found a bug in Debug.DrawLine and Debug.DrawRay
          I couldn’t get them to draw lines/rays in the editor, while doing it through a C# script works fine. There’s a chance I might be doing something wrong, but I thought I’d let you know.

          #22468
          Gavalakis
          Keymaster

            Hey,

            You are very welcome.

            If you are using a Debug.DrawLine version that takes a color parameter, just make sure that you set the color alpha, which by default is 0 (invisible) when the node is created 🙂

            Let me know if that was indeed the case.

            #22467
            immortalx
            Participant

              [quote quote=1019]Hey,

              You are very welcome.

              If you are using a Debug.DrawLine version that takes a color parameter, just make sure that you set the color alpha, which by default is 0 (invisible) when the node is created ?

              Let me know if that was indeed the case.

              [/quote]

              I can’t thank you enough! Yes, that was the case and in fact it was the same reason i couldn’t change group colors too! (I’d never thought a color picker would default to alpha = 0)

            Viewing 5 posts - 1 through 5 (of 5 total)
            • You must be logged in to reply to this topic.