Grenades never destruct

Amoo

New member
I am following this tutorial. I can't get my grenade to disappear after the lifespan I specified in the Grenade script on my grenade object and my explosion prefab isn't being spawned in either. The grenades just sit in the world like duds after they are thrown. Please help :)

More info:

I'm on Unity 2019.4.4f1 LTS
I'm using Universal RP, via the URP template
I'm using IL2CPP, not that it matters for this issue as the problem happens in-editor also
My grenade is actually a ThrowableItem, not a Grenade, because there is no pin to remove (it is a magic weapon)
I have deleted and remade my grenade numerous times following the linked tutorial trying to fix this, so it's unlikely to be a missed step in the tutorial
 
Last edited:
By default, a ThrowableItem will not start "cooking" a Grenade object on use. If you wanted to, you could sub-class Throwable Item and override StartItemUse similar to GrenadeItem.StartItemUse (in particular lines 46 and 47).

But it would be much easier to just use a GrenadeItem and disable its pin animation + remove the pin transform from the Grenade object.

Or, since you mentioned that it's a magic type item, you're probably better off using an actual Magic item. The demo scene contains a number of different Magic items, and here is the doc page for them:

 
Switching to a proper Grenade class completely fixed it, thank you so so much! I thought the only difference was the pin animation.

The pin Transform is null, but she still animates as if removing a pin. Is this because I used Animator Item ID 41? Is there a different ID that would better suit a magic weapon? Is there a list of these somewhere? EDIT: I found a list here! EDIT 2: The list is incomplete and only 41 seems to animate properly, and it has the pin removal animation :(

As for proper magic weapons, I will give them a try too, but I'm so close that I prefer not switch over just yet.

I am getting a stack overflow error when I enable the trajectory line (see attachment). Did I do something wrong?

EDIT: Two more problems I found:

1. The trajectory line pushes light spherical objects, causing them to roll backward.
2. When my character cooks the grenade all the way and it explodes in her hand, she still animates throwing it after taking damage.
 

Attachments

  • Unity_Zg26yLkfhD.png
    Unity_Zg26yLkfhD.png
    216.7 KB · Views: 7
Last edited:
The trajectory simulation is getting stuck in an infinite loop for some reason. Not exactly sure what could be causing this. Can you try reproducing this with the demo frag grenade and copying over your grenade's values?

As for the animator ID, you could try using 61, which is the ID for Fireball.

I would strongly recommend taking a look at the magic items, though, they sound perfect for your use case..!
 
Animator item ID 61 looks the best, but it animates at the wrong time. She animates as if throwing at the start before you finish cooking it, then when you release she stands still and it flies from her stationary arm.

I will try to reproduce it with the demo frag grenade.

Is there a way to fix the trajectory line pushing objects that it "collides" with?
 
We don't have an animation that doesn't have the pin removal so for this case you'll need to get a new set of animations. I recommend going with Andrew's approach though and use the Magic Item since it sounds like it is closer to what you are going for compared to the grenade.
 
I can't find any documentation or tutorial videos on how to get started with magic weapons. The documentation Andrew linked looks great for once you have one set up and want to customize it. But how do I get started? Are magic weapons even considered items? :D
 
Magic weapons haven't matured as much as the other weapons have so there's no video for those yet. You can get started by creating a new magic item (similar to the other items) and then begin to add magic actions to the Magic Item component. The bottom of this page shows an example setup. I have one more update to do to the magic items and then plan on creating a video.
 
Top