animation state doesn't change on a collision.

Hi folks,

I’ve just started unity by following some tutorials and I m on a stupid issue here that I can’t find the solution alone.

I have one sprite with 2 state (one idle animation and one destroy animation). When there is a collision between the mainPlayer and this brigde, the bridge explode but for a reason I don’t understand, the state stays on idle and don’t go to the next state.

Here a printscreen of the code I use (the debug log is printed in the console) and a printscreen of unity(simple state machine with one boolean condition (used bool to true).

any idea ?
thanks.


good day sir, correct me if I’m wrong according to your Capture2PNG.PNG which is the inspector of your transition the transition will activate if the bool used is true? and in your code when it collide the bool turns to false? is my understanding correct?

Hi

Will you be able to share your project for us to have a closer look at the problem?

Cheers

Hi all,

@Leo-Yaik => hereunder the project (I suppose I just have to zip it).
@3CIngenious => I tried true or false, I know , when something doesn’t work, it’s a bad idea to try everything (even reboot).

thanks

2223789–148029–LoadUp T1.7z (1.15 MB)

oki, seems I found. every entrypath need to be connected to the exit path.

Hi

From the project you sent, it seems like because your ‘template’ Animator component was disabled. That was the reason why the state wasn’t changing.

Cheers