Author Topic: Button problem  (Read 2191 times)

sk1989

  • Guest
Button problem
« on: July 26, 2012, 07:46:12 PM »
Hello all,

I came across a situation where I have a button called "ShopItem" and when this button is selected I moved the button off the screen while "ShopeItem" is selected and when its not selected it supposed to reappear. The problem that I am having is whenever I click anywhere on the screen the ShopItem button automatically deselects. I assume this is because that how the onSelect() listener works.

So what I really want is, so that ShopItem button only reappears when I click on another button. How can I listen to an event in that way, also keep in my mind that these buttons are all same when they are created. They are instantiated from a prefab. So if I were to use UIForwarEvent it wont work because Im trying to listen to an event of the same button that was instantiated from a prefab.

Anyhelp is appreciated thank you




ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Button problem
« Reply #1 on: July 27, 2012, 06:03:26 AM »
It sounds like you want some custom behavior, so you'll need to code that. I suggest not using a button for this. Keep in mind anything can receive and respond to click events, it doesn't need to be a "button" object. Create a sprite, add your custom script to it that will change its color based on your state, and listen to OnSelect events yourself, determining whether you should highlight the sprite or not.