Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Scrollview can't scroll with buttons that have Event Triggers

Discussion in 'UGUI & TextMesh Pro' started by enhawk, Nov 19, 2015.

  1. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    832
    Does anyone know a way around this? I'm using an event trigger to reset the visual state of the button after the cursor leaves it (not part of the default functionality, Unity leaves the button in highlighted state on pointerexit)

    Even empty event triggers disable drag scrolling of the view port while on buttons.

    Screen Shot 2015-11-19 at 17.24.49.png
     
  2. enhawk

    enhawk

    Joined:
    Aug 22, 2013
    Posts:
    832
    Seems you can only add this by code:

    Code (csharp):
    1.  
    2. using UnityEngine;
    3. using System.Collections;
    4. using UnityEngine.EventSystems;
    5.  
    6. public class Onpointerexit : MonoBehaviour, IPointerExitHandler {
    7.  
    8.     // Use this for initialization
    9.     void Start () {
    10.    
    11.     }
    12.    
    13.     // Update is called once per frame
    14.     void Update () {
    15.    
    16.     }
    17.  
    18.     public void OnPointerExit(PointerEventData dt) {
    19.         print("test");
    20.     }
    21. }
     
  3. DWilliams

    DWilliams

    Joined:
    Jan 12, 2015
    Posts:
    63
    Yeah I think the Event Trigger basically adds all event handler interfaces so is catching the ones that the scroll view needs.