When I reload the scene my enemies die outside of Fade

So I’m planning to replace this with json (if your course wiki doesn’t kill me) so I’m not sure if I should try to fix this or not.

When I first start the game the enemies do a die animation or if I come through a portal. But if I load with L it will do the correct thing. I’ve tried to look through my scripts and can’t find where I could fix it. Can you point me toward what I should be checking for?

Increase the FadeIn time. The characters need to go through the death animation to get to the lying on the ground dead state. A longer fade in time will allow this to happen while the screen is still faded out.

If I delete the save file my people die but if I play the game with an old save file my dead enemies don’t die after the portal. When I start the game they die but when I come through a portal they just stand there and aren’t interactable.

I think I’m confused…
With no save file at all (i.e. deleted) nobody should be dead. The video you showed (coming through the portal, so with a save file at that point) had the dead enemy dropping dead after the portal (it showed the animation because the fade in time was too quick).

Yeah it’s very strange. And it seemed to be working correctly this week then when I changed fade in time it stopped working. It doesn’t seem to make sense to me.

I’m not sure what’s going on with the zombie…
If you could zip up your file and upload it to https://gdev.tv/projectupload, I’ll see if I can figure out what’s going on.

Actually, I just remembered a prior cause for this sort of behavior, relating to loading/saving… it deals with the order in which components are attached to the characters…
It’s possible that the character that is still standing around being a zombie when it should be dead is having it’s animator reset when the Fighter loads the weapon…

If the character was built in the order we created the course in, then usually Fighter comes first, and Health afterwords, in which case, the Fighter equips the weapon, resets the animator (when the animatoroverride is change) and then Health kills the character, but sometimes (rarely) this can happen the other way round… if Health kills the character, and then the animator is reset, it will stand around like a zombie instead of dropping dead, and we are not teaching a zombie game in this course. :slight_smile:

Try adding this line to the beginning of EquipWeapon() in Fighter.cs:

if(GetComponent<Health>().IsDead()) return;

We don’t have weapons yet but yeah maybe it’s an order thing of initialization in awake/start or something? I’ll have a look at that.

I sent the file. I realized I’ve been avoiding the course so any help would be appreciated!

This one took me a bit to puzzle out, especially because when I went into the animators for the zombie character, it was showing that it was in the death state, but it was clearly animating the locomotion state on the screen…

I dug into the hierarchy, and discovered that there is still an animator on the child object (LPG92@T-Pose Bad. Sometimes, these child animators can override the parent one, and it’s not consistent enough to diagnose how or why this happens. Removing the animators from the child component fixed the issue.

Thank you so much! I had a feeling it’s because I was using my own stuff.

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Privacy & Terms