-
Notifications
You must be signed in to change notification settings - Fork 5
Destructibles
We want the entire environment to be destructible so this is an important document which outlines how to make objects within a level destructible. Fortunately, it is simple. Note, these instructions are not for enemies, but for passive objects in the environment.
A simple destructible is a single model that will be destroyed in a single event. See Assets/_Dev/Prefabs/Buildings/Pyramid.prefab as an example.

- Create a root object for your destructible
- Add a
Basic Health Managerscript and set the health value appropriately. As a guide early game weapons do around 10-40 damage. - Add an appropriate controller script to manage destruction. This will be
Assets/_Dev/Runtime/FX/DestructibleController.csor an extension class such asAssets/_Dev/Runtime/Buildings/BuildingController.cs. - Choose or create one or more
Scaled Destruction Particles, these are effects that will be scaled to fit the model and should represent the debris created. Some examples are provided inAssets/_Dev/Prefabs/FX/Destruction Particles. Be mindfull of performance when assigning particle effects. - Choose or create one or more
Scaled FX Particles, these will also be scaled to fit the model and should represent visual effects such as explosions and smoke. - Set the particle density. The higher this is set the more particles will be created, and thus the more expensive the effect will be.
- Set the explosive force. This is how much initial force is placed on the particles moving outward from the center of the model.
- Optionally add
Unscaled Particles, these are additional particle effects that will be created, but not scaled with the model.

- Create a child containing the model.
- Ensure there is a (non-trigger) collider on the model
- Add a
Basic Damage Handler - Optionally add a
Simple Surface

Note that it is possible to have the model and the managers on the same object. This is, in fact, more performant, however, it is less flexible. We recommend using the approach above initially and once a design is finalized then it can be optimized by collapsing the hierarchy.
If you want to have the overall structure destructible in stages then you will need one child for each stage. You can see an example of this in Assets/_Dev/Prefabs/Buildings/Control Center.prefab.
- Create a root Game Object
- Create one or more destructible objects, as described above, as children
