Download

Play object animation after click on button

Hello friends!

I am trying to add a mechanic to the level I am making.

So there is a box on my level, when you hit “e”, a widget pops up and two options come to the screen; “close the box” or “leave the box”; I already have done the leave the box option but I am stuck at the close the box part. I have already animated the box’s closing animation, it is ready and works perfectly fine. I just want to add this after clicking this “close the box” option that I have mentioned before.

Can anyone help me?

Thank you already!

What comes to my mind is to create a function in the box that will play the closing animation and cast to the box and run the function when the button is clicked.