Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

4.6 Event Trigger prevents dragging in a ScrollRect

Discussion in 'UGUI & TextMesh Pro' started by StephenMorris, Nov 21, 2014.

  1. StephenMorris

    StephenMorris

    Joined:
    Mar 25, 2013
    Posts:
    35
    Hi all,

    I have a child RawImage that is contained within a scrollview. If I add any EventTrigger's to this child object (such as PointerClick), the Image is now effectively locked and cannot move. How do I re-enable the dragging facility?
     
  2. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
  3. StephenMorris

    StephenMorris

    Joined:
    Mar 25, 2013
    Posts:
    35
    What I am trying to do is get the image's underlying pixel from the mouse click. If I add an EventTrigger (specifically PointerClick), I can then have the click specifically localised to the image (i.e. clicking anywhere else besides the images doesn't register the hit.

    Any suggestions?
     
  4. mimminito

    mimminito

    Joined:
    Feb 10, 2010
    Posts:
    780
    You may be able to receive the events yourself in your script by implementing the interfaces. Ive not found a good tutorial on this I'm afraid, but here are the interfaces for you to implement:
    http://docs.unity3d.com/460/Documentation/Manual/SupportedEvents.html

    You should be able to attach a script to your object you want to click on (which implements theIPointerClickHandler) and you should receive the event.

    Hope this helps.