Make ProjectileBase.Destruct accessible with no parameter in OnDeath

Cheo

Active member
Hello, ProjectileBase.Destruct was made public in 3.0.12 as I had personally requested, but that is actually not enough - the aim was to be able to call the Destruct void through the OnDeath event on a Health component, but the Destruct void either needs 2 Vector3 or a HitRaycast that can be null in its virtual version, but the latter can't be used through a Unity inspector event because we'd need to set the HitRaycast to null. So here's a simple workaround I made :

C#:
        public void DestructTest()
        {
            Destruct(null);
        }

Capture d’écran (1325).png

However, another problem has appeared : as strange as it may sound, I just checked with simple logs that this OnDeath event was not always called when the Health attribute reached zero ! It looks like it does when you shoot the two or three first grenades spawned into the scene, but after that the odds of the event being invoked decrease. I'm not seeing this on other objects though, only grenades. Could this please be looked into ? Thanks in advance.
 
Bumping this post - I'm still getting this issue in 3.0.14. Can this please be looked into ? Thanks.
 
For this situation you should subclass and add the method. I do not want to start to add an overloaded method for every situation as subclassing is the correct route to keep everything clean.
 
I honestly think this addition would be warranted, being able to destroy grenades by shooting them sounds like a feature that should be implementable out of the box. Still, that's not even the key issue here, I can always subclass it as you suggest like this :

Code:
using Opsive.UltimateCharacterController.Objects;

public class MyGrenade : Grenade
{
    public void MyDestructTest()
    {
        Destruct(null);
    }
}

But the issue remains exactly the same, the first thrown grenades do explode when shot at and their Health attribute reduced to 0, but at some point something seems to prevent the following ones from calling the OnDeath event. Could you please try this out for yourself ?
 
You want me to send you the grenade prefab with the Health attribute on it ? I can send you that in a few minutes if you want, but you should be able to make a quick try for yourself as well.
 
I sent you two packages by mail. See for yourself and tell me if you get the same issue.
 
Allow me to bump this thread - does the OnDeath event work correctly for projectiles on your end ?
 
Sorry for bumping this thread, but I just realized that Justin had actually sent me a fix package by mail back in July, which should be included in the next update. Just wanted to say that I checked it out and the issue is solved, sorry again about that !
 
Top