Author Topic: [Fixed]Buttons on scrollview are calling OnClick just once  (Read 3094 times)

rganeyev

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 22
    • View Profile
[Fixed]Buttons on scrollview are calling OnClick just once
« on: October 19, 2012, 05:09:34 AM »
I've implemented scroll view with buttons inside but has problem that buttons' OnClick are called just once. It's really strange. After that I've tested on Quest Log example and had the same effect!

I've opened Quest Log example and attached to SlicedSprite(which contains boxcollider and does tweening) my script:
  1. using UnityEngine;
  2.  
  3. public class TestButton : MonoBehaviour {
  4.      private void OnClick() {
  5.         Debug.Log("Test");
  6.     }
  7. }
  8.  

While running when I click that sprite, I get my Debug message, but just once. In other clicks on that sprite nothing happens.
How to deal with that? And why tweening works, but my code doesn't?

Thanks.

« Last Edit: October 21, 2012, 12:26:25 AM by rganeyev »

Nicki

  • Global Moderator
  • Hero Member
  • *****
  • Thank You
  • -Given: 33
  • -Receive: 141
  • Posts: 1,768
    • View Profile
Re: Buttons on scrollview are calling OnClick just once
« Reply #1 on: October 19, 2012, 09:20:31 AM »
Try turning on gizmos and see if your colliders are running off or something.

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Buttons on scrollview are calling OnClick just once
« Reply #2 on: October 19, 2012, 10:12:45 AM »
Check your Console log and turn off "Collapse" option.

rganeyev

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 22
    • View Profile
Re: Buttons on scrollview are calling OnClick just once
« Reply #3 on: October 21, 2012, 12:25:09 AM »
upps, sorry, what a stupid mistake!

Thank you!