Hi,
I really like how the panels in both Quest Machine and Dialogue System animate as they close and open. Is it possible to use the same animation for my other panels? If so, how would I go about doing that?
Thank you in advance.
[SOLVED]UI Panel Animator
-
- Posts: 118
- Joined: Thu Dec 19, 2019 7:38 am
[SOLVED]UI Panel Animator
Last edited by mschoenhals on Mon Oct 12, 2020 10:17 am, edited 1 time in total.
Re: [HELP]UI Panel Animator
Hi,
Sure! You can use the same animator controller as on the Quest Machine UIs. It's named UIPanelAnimator.
The easiest way to set it up is:
Sure! You can use the same animator controller as on the Quest Machine UIs. It's named UIPanelAnimator.
The easiest way to set it up is:
- Add an Animator component to your UI.
- Assign UIPanelAnimator to it.
- Add a UIPanel component. Call its Open() method to open it, Close() to close it, or Toggle() to toggle it between open and closed.
-
- Posts: 118
- Joined: Thu Dec 19, 2019 7:38 am
Re: [HELP]UI Panel Animator
Thanks for the reply Tony. It's not yet working. I'm calling Open/Close from OnTriggerEnter and OnTriggerExit using:
Is that correct? It does open and close but no animation. I have the Animator attached to the canvas with UIPanelAnimator as the controller. It does open and close but no animation.
Code: Select all
shopCanvas.GetComponent<UIPanel>().Open();
shopCanvas.GetComponent<UIPanel>().Close();
Re: [HELP]UI Panel Animator
Hi,
Set the UIPanel's Show Animation Trigger to "Show" (without quotes) and Hide Animation Trigger to "Hide". This is how the panel knows how to play the animations. (See the UIPanel on the Quest Dialogue UI prefab for an example.)
Set the UIPanel's Show Animation Trigger to "Show" (without quotes) and Hide Animation Trigger to "Hide". This is how the panel knows how to play the animations. (See the UIPanel on the Quest Dialogue UI prefab for an example.)
-
- Posts: 118
- Joined: Thu Dec 19, 2019 7:38 am
Re: [HELP]UI Panel Animator
Hi Tony,
Thanks for the reply. The triggers are set to Show/Hide (default). That is, on the UI Panel, Show Animation Trigger is "Show" and Hide Animation Trigger is "Hide" (no quotes).
I have the UI Panel component and the Animator on the root canvas of the UI panel that I want to pop up and close. Animator controller is set to UIPanelAnimator (no avatar).
I have no events listed on UI Panel; that is, On Open() and On Close() are empty. Is there suppose to be something in those fields??
I'm calling this in code:
The panel does open and close, but not with the animation.
Thanks for the reply. The triggers are set to Show/Hide (default). That is, on the UI Panel, Show Animation Trigger is "Show" and Hide Animation Trigger is "Hide" (no quotes).
I have the UI Panel component and the Animator on the root canvas of the UI panel that I want to pop up and close. Animator controller is set to UIPanelAnimator (no avatar).
I have no events listed on UI Panel; that is, On Open() and On Close() are empty. Is there suppose to be something in those fields??
I'm calling this in code:
Code: Select all
shopCanvas.GetComponent<UIPanel>().Open();
shopCanvas.GetComponent<UIPanel>().Close();
Re: [HELP]UI Panel Animator
Hi,
Try putting the UI Panel and Animator components on the child of the canvas (i.e., the panel). For example, in Quest Machine's demo, the UI Panel component is on the dialogue UI itself, not the dialogue UI's parent canvas.
If that doesn't help, then let's do this test:
1. Make sure your UI is visible in the scene view.
2. Inspect your main panel GameObject.
3. Open an Animation window.
4. In the Animation window, select the show animation and play it. Does it play the show animation?
5. Repeat for the hide animation.
Try putting the UI Panel and Animator components on the child of the canvas (i.e., the panel). For example, in Quest Machine's demo, the UI Panel component is on the dialogue UI itself, not the dialogue UI's parent canvas.
If that doesn't help, then let's do this test:
1. Make sure your UI is visible in the scene view.
2. Inspect your main panel GameObject.
3. Open an Animation window.
4. In the Animation window, select the show animation and play it. Does it play the show animation?
5. Repeat for the hide animation.
-
- Posts: 118
- Joined: Thu Dec 19, 2019 7:38 am
Re: [HELP]UI Panel Animator
Hi Tony,
Thanks very much for your help. I've decided to go another way with this particular UI.
Thanks very much for your help. I've decided to go another way with this particular UI.