Author Topic: Panel Animations (Example 3 - Menu)  (Read 874 times)

treydavis76

  • Newbie
  • *
  • Thank You
  • -Given: 0
  • -Receive: 0
  • Posts: 3
    • View Profile
Panel Animations (Example 3 - Menu)
« on: August 11, 2014, 03:35:25 PM »
Hi, I'm fairly new to Unity, and even more new to NGUI, and this is my first post, so please go easy on me!

I'm having a VERY hard time figuring out the proper way to set up a menu, so that it is invisible when the game starts, opens up by hitting the "escape" key, and goes away by hitting the "escape" key again.

In the Menu example (Example 3 - Menu), a button is clicked, hiding that panel, and the second panel is animated to come into view. 

Is there ANY video out there anywhere, or step by step document, that explains how to set up an animation for a menu panel!?  I've searched everywhere I could think of!

Again, all I want to do, is hit the "escape" key, have a menu fly in with a simple position animation, and then fly out when I hit the "escape" key again.

Thank you guys for any and all help you can give!
-Trey

Trance_Trap

  • Newbie
  • *
  • Thank You
  • -Given: 2
  • -Receive: 1
  • Posts: 5
    • View Profile
Re: Panel Animations (Example 3 - Menu)
« Reply #1 on: August 11, 2014, 10:25:23 PM »
The way I know of it quite a bit.

1st off which Camera is going to be sending the event? IF you use NGUI UICamera , ie. event system,
you'd have to pass it into the OnKey(Keycode keycode){} event   
e.g. "Input.GetKey(KeyCode.Escape)" if its in the method or just the keycode if you're passing it into the event

As for the animations, Study Unity's Animation course from unity3d.com/learn, there is a lot involved... You'd have to use the Animation window and attach an animator component and make a simple state machine if you're using mecanim

Ngui can also animate with its' tween components. e.g. from top border in Unity ... NGUI -> Tween -> "anyTweenYouWant"

Tweens is short for "In betweens" which is how the comp. interpolates between 2 points, you'd adjust the curves
to change how the comp. interpolates between points e.g. sharp or smooth or linear, etc
« Last Edit: August 12, 2014, 12:31:23 AM by Trance_Trap »
One Person can make a difference, and Every Person should Try. ~John F. Kennedy

My avatars' text: "You wouldn't like me when I'm angry... Because I Always backup my rage w/Facts & documented sources" ~The Credible Hulk(he's wearing glasses) ... Lol I just thought it was hilarious ^_^