[Melee] Null exception randomly on perfect block

rexdefuror 4 months ago in Melee updated by Marti (Lead Developer) 3 weeks ago 10


Null Exception randomly occurs on perfect block/parry.


NullReferenceException: Object reference not set to an instance of an object GameCreator.Melee.CharacterMelee.LateUpdate () (at Assets/Plugins/GameCreator/Melee/Mono/Components/CharacterMelee.cs:192)

This happens due to ComboSystem not being able to get the current clip from combo system.

What I also noticed is that right before this happens, a Stop method in ComboSystem has been executed, that sets the currentCombo entity to null.

Unity version:
Game Creator version:

Update on this matter. It happens when the weapon blade collides with the player when blocking.

Under review

Do you have the entire log? Everything that is printed in the console. This will help us narrow down the line of code issuing the exception.


That was actually everything in the log, I'll check if anything else could be found in the stacktrace.

As for where the exception is issued "attack" in the LateUpdate method is null when this happens, and it throws a null  exception when trying to do the "if (attack.pushforce" part. Probably due to weapon colliding with the character while triggering a block and not an attack. so the combo system doesn't find any "attacks" and thus breaks. From what i see there are no fallbacks for this edge case in the code.


The console should print a long message below when selecting it. If you can copy & paste that, it will help us. The line reported doesn't really inform of much, since it basically tells the "attack" object is null, but not from where it comes from.


I got this too. It is a nullReferenceException on CharacterMelee line 191. Attack == null. I suspect this happens when the melee clip is updated (in update) to end just before the hit happens (in late update. It can be reproduced pretty easily in the Melee example settup by trying to git gud with the perfect block.


Full message:

NullReferenceException: Object reference not set to an instance of an object
GameCreator.Melee.CharacterMelee.LateUpdate () (at Assets/Plugins/GameCreator/Melee/Mono/Components/CharacterMelee.cs:191)


Could it be that you're using the Notify Hit Action and you're not setting up an "Attacker"? Also, this attacker is expected to have the Character Melee component. 


Steps to reproduce this error easily:
1. Create a clean melee example project

2. In enemy Actions_SimpleAI remove all but startblocking and restart the action

3. Attack the enemy.
It happens about half the time as long as the enemy still has defence to block with.

I have this problem too, why do i need notify hit? (i don't even have that action)

parry Error.mov


Hey everyone, I've identified the issue and the fix is pipelined for the next update. I'm closing this issue, but feel free to reopen it if you experience it again. The new version should come out on Friday or next Monday.