Setting material of clicked object

FlowCanvas Forums Support Setting material of clicked object

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1011
    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.

    #1014
    Gavalakis
    Keymaster

    Hey,

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

    MousePickEvent

    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.

    Join us on Discord: https://discord.gg/97q2Rjh

    Attachments:
    You must be logged in to view attached files.
    #1016
    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.

    #1019
    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.

    Join us on Discord: https://discord.gg/97q2Rjh

    #1021
    immortalx
    Participant

    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.

    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.