Author Topic: Updating two or more sprites with one button?  (Read 3473 times)

Jeffom

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Updating two or more sprites with one button?
« on: May 12, 2016, 08:54:33 PM »
I have two sprites that are mirrored parts of a texture,
and I need to update their color using only one button, can I achieve this only using UIButton?

Thanks for any help

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Updating two or more sprites with one button?
« Reply #1 on: May 14, 2016, 06:26:56 PM »
You can have more than one UIButton script attached. You can also attach multiple UIButtonColor components, which is likely better for what you're doing.

Jeffom

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 5
    • View Profile
Re: Updating two or more sprites with one button?
« Reply #2 on: May 17, 2016, 02:58:50 PM »
Hello,
I've tried adding two buttons each pointing to one sprite in one object with one collider,
and only the first component is being updated.

I forgot to tell, but I'm using the version 3.7.7 of NGUI (and I'm not able to update it because we're still working with an old release version and we dont want anything to break because of an update)


ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Updating two or more sprites with one button?
« Reply #3 on: May 18, 2016, 05:11:54 AM »
Not much I can do with an old version of NGUI. I can only support the latest. That said, I am pretty sure nothing button-related has changed since then. Assuming you actually didn't forget to reference different sprites on your two UIButton components, it should work as expected.