RPG Combat Double Damage

I am having a problem with my Player Character after finishing up the Character Stats section of the RPG Core Combat Creator series.

When my Player Character deals damage, the first attack hit hits 1 time, but the second attack hits 2 times. Example below. you see that there are 3 events of 13 damage, but this is only off of 2 attacks.

First Attack
18:23:03
Enemy (2) took damage: 13
UnityEngine.MonoBehaviour:print (object)
RPG.Resources.Health:TakeDamage (UnityEngine.GameObject,single) (at Assets/Scripts/Resources/Health.cs:43)
RPG.Combat.Projectile:OnTriggerEnter (UnityEngine.Collider) (at Assets/Scripts/Combat/Projectile.cs:53)

Second Attack
18:23:04
Enemy (2) took damage: 13
UnityEngine.MonoBehaviour:print (object)
RPG.Resources.Health:TakeDamage (UnityEngine.GameObject,single) (at Assets/Scripts/Resources/Health.cs:43)
RPG.Combat.Projectile:OnTriggerEnter (UnityEngine.Collider) (at Assets/Scripts/Combat/Projectile.cs:53)

Second Attack
18:23:04
Enemy (2) took damage: 13
UnityEngine.MonoBehaviour:print (object)
RPG.Resources.Health:TakeDamage (UnityEngine.GameObject,single) (at Assets/Scripts/Resources/Health.cs:43)
RPG.Combat.Projectile:OnTriggerEnter (UnityEngine.Collider) (at Assets/Scripts/Combat/Projectile.cs:53)

First Attack
18:23:12
Enemy (1) took damage: 19
UnityEngine.MonoBehaviour:print (object)
RPG.Resources.Health:TakeDamage (UnityEngine.GameObject,single) (at Assets/Scripts/Resources/Health.cs:43)
RPG.Combat.Projectile:OnTriggerEnter (UnityEngine.Collider) (at Assets/Scripts/Combat/Projectile.cs:53)

Second Attack
18:23:18
Enemy (1) took damage: 19
UnityEngine.MonoBehaviour:print (object)
RPG.Resources.Health:TakeDamage (UnityEngine.GameObject,single) (at Assets/Scripts/Resources/Health.cs:43)
RPG.Combat.Projectile:OnTriggerEnter (UnityEngine.Collider) (at Assets/Scripts/Combat/Projectile.cs:53)

Second Attack
18:23:18
Enemy (1) took damage: 19
UnityEngine.MonoBehaviour:print (object)
RPG.Resources.Health:TakeDamage (UnityEngine.GameObject,single) (at Assets/Scripts/Resources/Health.cs:43)
RPG.Combat.Projectile:OnTriggerEnter (UnityEngine.Collider) (at Assets/Scripts/Combat/Projectile.cs:53)

Looking at the above, am wondering if the Health:TakeDamage script and the Projectile:OnTriggerEnter script are both firing.

Now from the Basic Combat section to the end of the Simple Weapons section, my attacks always hit once, but upon completing the Character Stats, that is when I noticed the double hit attacks. It is intermittent and I cant figure out where it happens.
Double Damage Hit

It looks (from the logs posted) like OnTriggerEnter is firing twice, which is quite odd.

There are a couple of possibilities… First, check your enemy character for extra colliders that don’t need to be there. The only collider on the character should be the Capsule collider (some Synty assets have colliders on parts of the skeleton). It’s possible that it’s firing twice because the fireball is intersecting more than one collider.

As a brute force method of preventing double firing, try adding a boolean variable to the projectile
bool hasAlreadyHit=false;

Then in OnTriggerEnter, if it determines that you have hit the character you’re aiming for, set that bool to true. At the beginning of OnTriggerEnter, add the line if(hasAlreadyHit) return;

Privacy & Terms