How to show and hide a Button and don't affect the Animation on it.
A Button has Animation to controll it's Alpha of and Scale. i want to hide the Button and let the animation still running . And when i show the Button, it will at some frame of the Animation.
So, i can't use SetActive or change the alpha or size of the Button.
I try to change the Button's Layer runtime to a non culling mask Layer of Camera, the Button is a child of a Panel, the Panel is in UI Layer, i don't know why it is can't work.
What should I do?
You can do this by first by selecting the button in the hierarchy, then right click the button and select UI\Image
.
Set the source image reference of the image to the sprite that you want to animate. You will now need to size the image object and move in on the button where you want. Next you need to add/create your animation on this new image object.
Once this is done test to make sure that everything looks correct. Now all you need to do is change the parenting of the game object with the image and the animation to fall directly under the canvas.
Now you can activate/deactivate the button all you want and it will not affect the animation.
Here is a sample video showing how to set it up.
Thank you very much. But I'm sorry I think i didn't explain my question clear.
The animation actually controll the alpha and size of the button. I want to make the button invisible and the animation is still running . So when i make it visible, the button will at some frame of the animation. I just want the button don't renderer on the scene, but i don't know how to write.
I got two ways : 1. someButton.GetComponent().EnableRectClipping(new Rect(0, 0, 0, 0)); 2. Select the type of Image to Filled. And set the value of fillAmount.
Your answer
Follow this Question
Related Questions
Help dealing with dynamically changing 2D shape 0 Answers
Unable to make animations for UI Image 2 Answers
[SOLVED] GUI Button Rotate animation Unity 5 1 Answer
Problem with animated image on canvas 0 Answers
How to animate a UI panel? 1 Answer