简体   繁体   English

为什么按钮动画无法在Unity中触发?

[英]Why button animations don't fire in Unity?

After adding GameObject to Hierarchy, I added Image and Button components. 将游戏对象添加到层次结构后,我添加了图像和按钮组件。

I then set the button's transition settings to animation. 然后,我将按钮的过渡设置设置为动画。

I created a button controller and added sprite images to Normal, Pressed, Highlighted, and Disabled, respectively, to create an animation. 我创建了一个按钮控制器,并将精灵图像分别添加到“正常”,“按下”,“突出显示”和“禁用”以创建动画。

Normal animation works well, but Pressed, Highlited animation does not. 普通动画效果很好,但“按下,突出显示”动画效果不佳。

Why is this a problem? 为什么这是个问题?

Due to this problem, we are unable to proceed to the next step. 由于这个问题,我们无法继续进行下一步。 Please help me. 请帮我。

I wrote the question with the same problem 我写了同样的问题

The link is below. 链接在下面。

Why does not the button animatIon in Unity? 为什么Unity中的按钮没有动画?

Please help me. 请帮我。 I need help. 我需要帮助。

If you are using the Image and Button components that are part of the Unity UI ( Component -> UI -> Image ) then these components require a Canvas in order to render. 如果您使用的是Unity UI中的Image和Button组件( Component -> UI -> Image ),则这些组件需要Canvas才能呈现。

Instead of creating an empty game object and adding these components manually, use the GameObject -> UI -> Button menu option. 使用GameObject -> UI -> Button菜单选项,而不是创建一个空的游戏对象并手动添加这些组件。 Unity will automatically add the new GameObject to an existing canvas, or create one. Unity会自动将新的GameObject添加到现有画布,或创建一个画布。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM