Explosive
A detailed guide on how to use and setup the explosive.
Last updated
Was this helpful?
A detailed guide on how to use and setup the explosive.
Last updated
Was this helpful?
Explosives rely on the Explosive
component to handle all explosion-related functionality, including force, damage, visual effects, and more. To create a new explosive, either drag and drop your explosive model into the scene or create an empty GameObject to serve as its base.
Since this is a new GameObject, it won't have any components by default—unless it's a model, which may come with some. To make the explosive functional, begin by adding the Explosive
component to the GameObject.
To begin adjusting the explosion range and debugging, scroll to the bottom of the Explosive
component and enable the Debug option. Then, activate Ranges and Rays to visualize the explosion parameters in the scene.
The red range represents the Death Range, which you can find at the top of the Explosive
component. Any object within this range will have its health instantly set to 0. The blue range applies damage based on the distance between the explosion center and the target—closer targets receive more damage.
At this stage, the explosive is set up and capable of dealing damage, but it won’t detonate on its own—it needs a trigger.
To make the explosive react to bullets or other damage sources, enable the Damageable option in the Explosive
component. This allows it to explode when it takes damage.
Once the Damageable option is enabled, the explosive will take damage from any weapon or damaging source. If its health reaches zero—whether from gunfire or nearby explosions—it will automatically detonate.
To make the explosive detonate after a delay, similar to a triggered grenade:
Enable Explode After Delay
In the Explosive
component, check the Explode After Delay option.
Set the Delay Time
Adjust the delay time at the top of the Explosive
component to determine how long after activation the explosion will occur.
This will trigger the explosion automatically when the game starts, with the specified delay before detonation.
To add an explosion effect that spawns when the explosive detonates:
Assign Explosion Effect
In the Explosive
component, locate the Explosion field.
Link the Effect Drag and drop the desired explosion effect (such as a particle system or prefab) into the Explosion field.
This will ensure the explosion effect is triggered when the explosive detonates.
The same steps apply to adding a Crater Decal, with a slight difference in how it spawns:
Assign Crater Decal
In the Explosive
component, locate the Crater Decal field.
Link the Decal Drag and drop the desired crater decal (usually a burned ground effect) into the Crater Decal field.
Spawning Behavior The crater decal will be spawned on the bottom surface of the explosion, creating a realistic burned ground effect where the explosion occurs.
The explosive also offers additional features to enhance its functionality, such as the Explosive Type setting. There are two types available:
Ray Tracking In this mode, the explosion casts a ray from its center to the target hittable object. If the ray detects any obstacles within the defined Hittable Layers that block the path, it will ignore the hit. This makes it ideal for more precise explosions where you want to account for barriers or cover.
Standard The standard type bypasses the ray detection and damages everything within the explosion's radius, regardless of any obstacles in the way. This results in a more straightforward and indiscriminate explosion effect.
Both types allow you to customize how explosions interact with the environment, giving you greater control over gameplay dynamics.
This explosive also includes an additional feature that temporarily muffles the player's hearing after detonation. This effect reduces the sound levels for a fixed duration before returning to normal.
By default, this feature is enabled in all default explosives, but it is disabled in the Explosive
component itself by default. To activate it, simply enable the Muffle Hearing option in the Explosive
component.