Author Topic: Stucked with making simple tween interaction  (Read 5665 times)

AlexSudnikov

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 9
    • View Profile
Stucked with making simple tween interaction
« on: May 23, 2013, 03:14:48 PM »
Hey guys,

I'm pretty new to unity and ngui and I'm kind of lost...i'm trying to animate a menu : when it's "OnHoverTrue" it's got to play forward..."OnHoverFalse" got to bring it back to it's initial position.I've got two UIButtonTween scripts and TweenPosition on an object but it's doesn't work right.I'd be happy to get any advice, thanks!

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Stucked with making simple tween interaction
« Reply #1 on: May 23, 2013, 09:12:42 PM »
A single animation with UIButtonPlayAnimation script triggering it, with trigger set to "OnHover" will do just that.

Same as a single tween with UIButtonTween triggering it, with trigger set to "OnHover".

The true/false stuff is handled automatically for hover events.

AlexSudnikov

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 9
    • View Profile
Re: Stucked with making simple tween interaction
« Reply #2 on: May 24, 2013, 05:00:13 AM »
Thanks a lot for the answer.
Well , i think the real problem is that OnHover event is being triggered continiously...so my menu animation looks more like shaking.I wonder if there is kind of OnMouseEnter trigger.

mathiassoeholm

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 4
  • Posts: 35
    • View Profile

AlexSudnikov

  • Newbie
  • *
  • Thank You
  • -Given: 1
  • -Receive: 0
  • Posts: 9
    • View Profile
Re: Stucked with making simple tween interaction
« Reply #4 on: May 24, 2013, 08:04:24 AM »
Yeah thx, i've read about it.
The thing is that it doesn't seem to work with ngui.I mean , when it's just unity camera - it works great.
Once i add NGUI's gui setup it's just won't seem to call this event...

ArenMook

  • Administrator
  • Hero Member
  • *****
  • Thank You
  • -Given: 337
  • -Receive: 1171
  • Posts: 22,128
  • Toronto, Canada
    • View Profile
Re: Stucked with making simple tween interaction
« Reply #5 on: May 24, 2013, 05:44:08 PM »
OnMouseEnter is a Unity callback, and should not be used. OnHover is an NGUI callback, and should only be called once, not continuously. Why would it be continuous? Do you disable the collider causing it to leave the area next frame?