• Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
2
Question by Rs · Nov 25, 2014 at 12:03 AM · inputtoggle4.6scroll

4.6 Scroll Rect not working with Event Triggers?

Hi all, I've setup a Scroll Rect to scroll a Toggle Group with a bunch of Toggles. If I use the OnValueChange event in the Toggle component the scrolling works perfectly. Instead, if I want come more complex logics and I use an Event Trigger component (to get Select, Deselect and other events) these seem to absorb the touch event breaking the scrolling functionality.

Is someone else having this issue? Do you know what may cause it and a workaround?

Thank you all.

How to reproduce the problem step by step

  1. Create a new scene

  2. Create a UI Canvas

  3. Create a UI Panel, call it "Scroller" and make it child of your canvas

  4. Create another UI Panel, bigger than the previous one, and make it child of the previous panel, call it "Content" and make sure it is assigned an image.

  5. Create a new game object and add a Toggle Group component to it. Call it toggle group and make it child of you "Content" panel.

  6. Create one or two Toggles, add some graphics to them (image or text) and make them children of "Content"

  7. Test the scrolling. It should work even when you start dragging from one of the toggles.

  8. Now add an Event Trigger component to your triggers, add a couple of event types (Select and Deselect will do).

  9. Test again. Now it shouldn't work when starting to drag from any toggles.

Comment
Add comment · Show 6
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image Kiwasi · Nov 25, 2014 at 12:04 AM 0
Share

I may have encountered a similar problem in one of my tutorials. I'll have a play and see what I can come up with.

avatar image Rs · Nov 25, 2014 at 12:53 PM 0
Share

Sweet! Good to know I'm not alone. :) Let me know.

avatar image hadesfury · Dec 04, 2014 at 11:13 AM 0
Share

It's happening in release 4.6.0

avatar image gslance · Feb 18, 2015 at 11:50 AM 0
Share

Was there ever a fix for this?

avatar image BlackPhi · Mar 14, 2015 at 01:39 AM 0
Share

I hit this problem too, so I had a little play.

  1. If I put the scrollable panel inside another parent panel and attach an event trigger to that parent then scrolling is fine.

  2. If I put a (smaller) button inside the scrollable area and attach an event trigger to the button then I can scroll from anywhere in the scrollable area except for the button.

It looks as though mouse/touch events are being passed from front to back of the UI under normal circumstances, but the event trigger script is consuming all of them, rather than passing them on, not just the ones specified in the trigger.

The obvious solution would be to code our own event scripts, ignoring the supplied event trigger one. Either that or find some way of coding a pass-through in the functions called by the trigger.

Any thoughts?

Show more comments

6 Replies

· Add your reply
  • Sort: 
avatar image
3

Answer by Railon23 · Apr 20, 2015 at 03:12 AM

Had the same issue right now. Found this solution and it works perfectly for me: http://answers.unity3d.com/questions/852385/onpointerclick-function-not-triggering.html

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
2

Answer by Chris9 · Feb 24, 2015 at 08:55 AM

Hello,

Check these interfaces : http://docs.unity3d.com/460/Documentation/Manual/SupportedEvents.html

You can achieve this by adding to your GameObjects a Monobehaviour which implements every one of those.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by MFen · Mar 03, 2016 at 02:20 PM

Fairly old question but ran into somewhat same situation with Unity 5.3.3. Easy way to fix is put your eventtrigger on the scroll rect instead of the object you want to cause the trigger, the scroll rect triggered it for me.

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by mk26 · Sep 04, 2015 at 10:21 AM

Can be fixed using this OnDeselect

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
0

Answer by $$anonymous$$ · Nov 24, 2016 at 04:15 PM

a work around would be to use a button component and then add the triggers to that button using the already supplied "On ClicK" trigger of the button itself rather than using standalone event trigger components. it is strange but it works

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
  • 1
  • 2
  • ›

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.



Follow this Question

Answers Answers and Comments

12 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

how do i set up the mouse wheel? 1 Answer

Character Zoom in and out 1 Answer

[4.6] Adding scroll to this combo? 0 Answers

How to get UI elements such as Scroll Rect to work with new input system? 0 Answers

Toggle between Touch input and accelerometer 0 Answers

  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges