[Released] DestroyIt - Cinematic Destruction System

ModelShark Studio is happy to announce DestroyIt, a cinematic destruction system for Unity Free and Unity Pro!

Asset Store Link

NEW in v1.13!

Version 1.13 includes a custom Shader Graph shader for URP, which allows you to have progressive damage textures on your Universal Render Pipeline materials.

Another new feature is the auto-deactivate destructibles, for when you have thousands of destructible objects in your scene.

The framework provides throttling tools for performance, material pre-loading and transfer for seamless visuals, a particle manager, and object pooling. A wealth of particle effects, sample destroyed prefabs, and documentation are also there to get you started. DestroyIt was designed to meet the following requirements:

Highly Scalable
DestroyIt comes complete with a Destruction Manager, a Particle Manager, Object Pooling, and a Material Preloader for high performance.

Realistic Destruction
DestroyIt was designed to use destroyed prefabs that break apart realistically and produce convincing, persistent debris. Flying debris can damage players and enemies, and can also be used for cover, which creates emergent gameplay.

Emergent Gameplay
When objects can be destroyed into realistic debris, it adds a facet of emergent gameplay and player choices that goes beyond visual effects. Create walls that can be breached; towers that can topple; and trees that can be chopped down.

What You Get

  • Full C# source code, no DLLs

  • All Particle effects shown

  • Progressive damage shaders, with textures

  • Demo that illustrates all core features

  • Demo that showcases many features using Unity’s free Shanty Town SUV model.

  • All demo scene assets

No programming knowledge is necessary but is helpful if you want to extend the system.

Check out the demo!

Written instructions for the destructible trees can be found here: http://www.modelshark.com/Content/DestroyIt-Destructible-Trees.pdf




If you have urgent questions, please send us an email. The forum doesn’t always let us know a post has been made.

Always back up your project before updating your package.

Changelog

Changelog:

v1.15 (Apr 2022)

Note: Version 1.15 of DestroyIt is for Unity 2020 and above. Use 1.14 or earlier for older installations of Unity.

New Features

  • Added audio clip fields to the Destructible script, so it can play sounds when the object is damaged, repaired, or destroyed.
  • Added ability to scale Damage Effects prefabs on the Destructible script, much like how Fallback Particle Effect lets you override the scale on the Destructible script.
  • Added “Limit Damage” checkbox to Destructible script, so you can now specify Max and Min damage per hit, plus the minimum amount of time (in seconds) that must pass before the object can be damaged again. Really useful when you need rigidbody collisions to do a more predictable amount of damage.
  • Added a checkbox to DestructionManager that allows you to globally enable/disable damage to Destructible objects. This lets you turn on/off damage to destructible objects in one place.
  • Added Custom DestroyIt HDRP Lit shader and updated the DestroyIt User Guide on how to use it.
  • Fallback Particle Effects can now be set to Parent Under a transform. This is helpful for when you need the particle effect to follow along under a different game object.

Minor Updates

  • Updated: Code to work with Unity 2020.3.32f1 (LTS)
  • Re-centered the demo scenes so when they are opened for the first time (at world position 0,0,0) you see the scene correctly, instead of seeing a dark area with no terrain.
  • Removed the “DestroyIt-Ready” feature and removed the mentions of it in the User Guide PDF.
  • Added a ShockwaveSphere script, which is similar to the nuke’s Shockwave Trigger Wall script, but this one moves out as a radius from the initial blast instead of as a wall.

Bug Fixes

  • Damage Levels were not recalculating when totalHitPoints were modified at runtime through code. TotalHitPoints and CurrentHitPoints are now public properties with backing fields.
  • DamageLevel hitpoint ranges are no longer cast to integers, which was causing an issue with destructible objects with very low hit points (ie, 5hp total with 5 damage levels) not progressing to the next damage level properly.
  • Set ObjectPool container to inactive to prevent unwanted OnEnable events (such as destroyed sounds) when scene starts.
  • ObjectPool no longer throws errors about “key already exists with that instance ID” when using nested prefab copies of Destructible objects.
  • Moved the Particle Alpha (no fog) shader out of the “Demos (safe to delete)” folder, because the default particles use them and they are therefore required for the main DestroyIt asset. Now you can delete the Demos folder and not get pink textures on the default particle effects.
  • Objects with DontDoDamage tag were doing damage to static destructible objects and destructible objects without rigidbodies.
  • Issue with HitEffects where it was only playing the first effect found. Now plays all effects.
  • Small issue with StructuralSupport script where it would only remove joints that had connected rigidbodies. Changed it so it removes all FixedJoints.

v1.14 (Apr 2021)

  • Updated to Unity 2020.3.4f1 (LTS)
  • New Feature: You can now override the fallback particle’s mesh materials and scale, regardless of whether it’s a custom particle effect or the default (unassigned) one.

v1.13 (Apr 2021)

  • Updated to Unity 2020.3.2f1 (LTS)
  • Two new URP Shader Graph shaders were added to support the Universal Render Pipeline with progressive damage textures.
  • Destructible terrain trees now support parent LOD Group components, so they are able to randomly rotate when painted on terrain.
  • ChipAwayDebris was modified so it now removes any non-kinematic rigidbodies it finds on the destroyed prefab before spawning in.
  • New Feature: Structure-Supported Debris (Scenario #30). Allows you to quickly add structural support joints to fractured debris so it stays together.
  • Added the text “REPAIR” to the wrench HUD UI so it’s more obvious that it’s a repair tool, not a weapon.
  • Destructible terrain trees are now hidden when destroyed and remain part of the terrain data, removing the need for resetting tree instances and terrain height.

v1.12 (Jul 2020)

Major Changes

  • Added PlayMaker support for Destructible Actions (Damage, Repair, Destroy) and Events (OnDamaged, OnRepaired, OnDestroyed) and illustrated it with a new PlayMaker demo scene (under Extras).

Bug Fixes

  • Changed RepairDamage(int) to RepairDamage(float) on the Destructible script in order to support both float damage and repairing.
  • Destructible scripts would process collisions and take damage even when disabled. Now you can disable Destructible scripts and they will not process collisions, as expected. (Note: Destructible terrain trees still process collisions and take damage when the Destructible scripts are disabled, as intended).
  • Added a safety check in GetMeshCenterPoint() method to fix errors when a MeshFilter does not have a shared mesh.
  • Added safety checks to all code that un-registers an event when OnDisable() fires, to prevent the possibility of null reference exceptions.
  • Added a safety check to the ExplodeAfter.cs script to handle if there is no explosion prefab provided.
  • Fixed: Debris from ChipAwayDebris objects that were reparented to moveable objects would move along the ground with the object.
  • Fixed: Mesh center point calculation for static meshes changed from gameObject.isStatic property to meshRenderer.isPartOfStaticBatch property.
  • Fixed: Debris from destroyed objects which were added to the Object Pool manually (or not pooled at all) were not being initialized/configured properly, and velocity was not being tranferred to the debris after spawn.

Minor Changes, Cleanups, and Enhancements

  • Updated DestroyIt to Unity 2019.4.5f1 (LTS).
  • Added the WhenDamagedDamageParents script, so you can have Destructible objects damage their parents when they are damaged.
  • Added public Destroy() method that can be called on a Destructible object to destroy it immediately.
  • Cleaned up QuickStart demo scene, removing unneeded terrain and textures.
  • Created a PlayMaker action that applies damage to a Destructible object (DamageDestructibleObject)
  • Created a PlayMaker action that destroys a Destructible object (DestroyDestructibleObject)
  • Created a PlayMaker action that repairs a Destructible object (RepairDestructibleObject)
  • Added a script to send the Damaged event from a DestroyIt Destructible to PlayMaker.
  • Added a script to send the Repaired event from a DestroyIt Destructible to PlayMaker.
  • Added a script to send the Destroyed event from a DestroyIt Destructible to PlayMaker.
  • Added a new demo scene that illustrates how to use Playmaker actions and how to listen to DestroyIt Destructible events (under Extras)
  • Updated DestroyIt User Guide, adding a section on how to use the new PlayMaker Actions.
  • Extracted the DestroyIt-Ready user guide from the nested asset package and placed it at the root of the Extras folder, so you can read it without needing to unpack anything.
  • Renamed ObjectPool container to “DestroyIt_ObjectPool” instead of “_ObjectPool” to avoid conflicts with other object pooling systems.
  • ObjectPool now checks for an existing object named “DestroyIt_ObjectPool” and uses it instead of always creating a new container object regardless.
  • Mesh center point is now only calculated for a destructible object if it uses a fallback particle effect.
  • Added a Debug.Log for when you have a Destructible object with one or more static meshes, but no position override for the fallback particle effect. “Particle effect may not spawn where you expect.”
  • On the Destructible script, if you use a Material Override for a particle effect, the system now applies progressive visual damage on the override material if it supports it.
  • Scenario #27 (Static Meshes) in the Main Demo Scene is now split into three separate variations of the scenario, for clarity and testing.
  • Angular Velocity is now also tranferred to debris from the Destructible object that spawned it. (Before, it was only Velocity that was transferred.)

v1.11 (Apr 2020)

  • Updated for Unity 2019.3.7f1 compatibility
  • Improved memory performance for progressive damage and destroyed prefab material transfers by modifying MaterialPropertyBlocks instead of directly changing materials at runtime
  • Removed the MaterialPreloader script entirely, as it is no longer needed to boost performance by creating hundreds of material variations at runtime
  • Removed the need to put progressive damage materials in the Resources\Material_Preload folder. You can put them anywhere now, and they will work fine
  • You can now make objects destructible even when they have no colliders or rigidbodies (see Scenario #29 in the Main Demo Scene). You can still apply damage to these objects through the normal ApplyDamage() method. Useful for things like scripted or far-off damage effects that the player cannot interact with
  • Fixed “missing GUI Layer” warning on Main Camera component in QuickStart scene (Unity 2019-related)
  • Fixed an issue with detail masks and texture maps being incorrectly used by the Material Preloader for progressive damage textures (Unity 2019-related)
  • Fixed “Check Winding” error caused by one of the SUV meshes
  • Added option to backup terrain in TreeManager because of “The specified path is not of a legal form (empty)” bug in Unity (Unity 2019-related)
  • Repackaged DestroyIt-Ready as a separate package bundle to prevent build-time errors
  • Fixed “Couldn’t create a Convex Mesh from source mesh ‘rock_low’ within the maxinum polygons limit (256)” error (Unity 2019-related)

Notes:

  • If you are applying this update to an existing project, you may get a “missing script” warning for the MaterialPreloader component. You can safely remove this component, as it is no longer needed
  • While we were able to improve memory performance for progressive damage and destroy prefab material transfer operations, we were not able to improve material transfers to mesh particle effects. Destructible objects that spawn particle effects that have materials transferred over to them will still create one material per renderer, per effect. This is due to a bug in Unity that causes MaterialPropertyBlock changes to not take affect on ParticleSystemRenderers that are set to RenderMode:Mesh. If you want to keep your material usage super-clean, manually assign your fallback particle effects rather than relying on the defaults (example: Scenario #4 - The Exploding Barrel in the Main Demo Scene).

Known Issues:

  • When importing the DestroyIt asset package, you may get an error message “A tree couldn’t be loaded because the prefab is missing”, even though there are no missing tree prefabs on the terrain in question. In this case, it is not a real error and can be ignored. Best we can tell, this is happening because we use a customized version of the SpeedTree shader for destructible trees, because it thinks the prefab doesn’t have any valid mesh renderers when it actually does. It works fine, though, both in the editor and building the scene.
  • If you turn on the Backup Terrain feature on the TreeManager script and you have the solution open in Visual Studio, you may get an error message “The specified path is not of a legal form (empty)” thrown from the TreeManager script. This error is not a real error and can be ignored.

v1.10.2 (Mar 2019)

  • Removed ResetTreeWhenDestroyed script from the demo scene tree in the Main Scenarios scene. Feature has not yet been implemented.
  • Corrected ImportFBX errors on demo meshes.

v1.10.1 (Feb 2019)

  • Fixed a bug in the DestroyIt-Ready destructible converter script that would happen when an entire folder of Destructible Stub prefabs were selected.

v1.10 (Jan 2019)

Major Features

  • Support for destructible terrain trees.
  • New Auto-Activate feature on DestructionManager script allows you to have thousands of deactivated destructible objects in the scene and activate them when player is near.

Unity Version

  • Updated DestroyIt to Unity 2018.3

Enhancements/New Features

  • Blast effects (rocket, nuke, various explosions) now apply damage using both BlastForce and BlastDamage parameters instead of only BlastForce.
  • Rocket and Explode scripts modified so they have three blast radii - Point Blank, Near, and Far. You can adjust the damage and radii of all three.
  • Added new SpawnObject script to spawn particle effects directly from the object pool.
  • Improved the way AutoPooling works - Destructible scripts insert objects into the pool instead of the ObjectPool looking for Destructibles in the scene.
  • Implemented auto backup/restore process for terrainData tree changes in the Unity Editor if Unity crashes.
  • Implemented process to save destructible tree stand-ins to a hashed Resources path so you can manage destructible drees for multiple scenes without conflict.
  • Hit points of destructible objects can now have decimals.
  • New menu option Window → DestroyIt → Setup - First Person Controller adds a first person controller gameobject with camera and pre-configured weapons to your scene.
  • InputManager was moved from the GameManager to the FirstPersonController prefab.

Particle Effects

  • Added LeafBulletHit, LeafParticleEffect, and LeafParticleEffectHeavy.
  • Updated all particle effects to use the 2018.3 particle shaders.

Bug Fixes

  • Fixed DestroyIt Mobile shader to correct an error reported in the console, and to fix the progressive damage texture.

v1.9 (Jun 2018):

  • Updated DestroyIt to Unity 2018.1
  • Replaced wooden chest (Main Scenarios Scene, #14) with a model that uses a single material
  • Fixed explosion effect on explosive barrel (Main Scenarios Scene, #4)
  • Cleaned up meshes in demo scenes (removed n-gons) to correct texture import warnings
  • Removed legacy shader for palm tree (Main Scenarios Scene, #21)
  • Fixed rotating particles on ConcreteDebris particle effect
  • Removed FadeTreeSwaying script since it only worked with legacy nature shader

v1.8 (Apr 2018):

  • Updated the Nuke weapon particle effect
  • Replaced demo object #4 with a gas barrel model and replaced the explosion with one from the Unity Particle Pack
  • Replaced demo object #10 rock with a new rock
  • Retextured demo objects #12 and #13, cog box, and reduced number of textures used
  • Modified demo objects #17 and #18 targets to use only a single material
  • Adjusted the height and angle of the Nuke trigger GameObject on the First Person Controller
  • Reduced the size of several textures: track blinds, flag, pipe wrench, and rocket launcher sight
  • Modified the Flag prefab GameObject to remove the Hinge Joint due to Unity no longer allowing non-convex colliders to work with non-kinematic rigidbodies

1.7.1 (Jan 2018)

  • Cleaned up Standard Assets references so there are no assetId conflicts with DestroyIt when importing any Standard Assets package.

1.7 (Dec 2017)

Fixes:

  • Updated to Unity 2017.2
  • Fixed muzzle flash particle effect for M4 rifle - now uses custom simulation space to stay attached to rifle muzzle.
  • Removed unused JavaScript Standard Asset scripts.
  • Fixed missing references for rocket launcher on Mass Destruction Demo scene.
  • Fixed object pool warnings on SUV Showcase Demo scene when restarting the scene with the ‘R’ key.

1.6 (July 2017)

Enhancements:

  • Updated DestroyIt to Unity 5.6.2.
  • Added a Mobile-Friendly Blinn-Phong lighting shader that supports progressive damage (see Main Demo Scene: #26).
  • Added an ALL DEBRIS option for the Reparent Debris field on the Destructible script.
  • Added ability to assign a parent for the destroyed prefab on the Destructible script.
  • Added option to turn kinematic off on unparented child rigidbodies (it’s still on by default).
  • Added option to override the Fallback Particle position (especially useful for static meshes, see Main Demo Scene: #27)
  • Added option to set kinematic True/False for reparented debris (such as the longsword in Main Demo Scene: #19)

Minor Enhancements/Optimizations:

  • Minor visual effects tweak (CogBox): Progressive damage is now more obvious, sparks particle effect render queue now based on shader so smoke doesn’t hide it.
  • Optimized the demo scenes to work with Gamma lighting (Unity’s default). Better visuals for mobile and WebGL builds of the demo scenes.
  • Optimized the demo terrain by reducing it to 512x512 and rebuilding the splatmaps. Greatly reduced build size for demo scenes.
  • Added a “Choose Demo” scene and wired it up to the Main Scenarios Scene and SUV Showcase Scene by use of the Main (M) button.
  • Added a Loading Screen and WebGLWarmUp object to demo scenes which pre-destroys objects in the scene to help WebGL build performance.
  • Removed “Tag Debris As” from all scripts and editors (no longer needed - use HitEffects script instead).
  • Added many tooltips to the Destructible editor script to explain the various options and when you would use them.

New Scenarios in the Main Demo:

  • Scenario #25: Dynamically adding a destructible object to the scene at runtime.
  • Scenario #26: Mobile shader for DestroyIt that supports progressive damage.
  • Scenario #27: Static meshes and using the fallback particle position override.

Bug Fixes:

  • Destructible objects set as static were invisible when the scene loaded, because GetMeshCenterPoint was accessing the mesh instead of sharedMesh.
  • Added more null checks to DestructionManager so errors will not be thrown if DestructionManager doesn’t exist but there are Destructible objects in the scene.
  • Added [DisallowMultipleComponent] attribute to Destructible, TagIt, and HitEffects scripts to prevent putting more than one of these components on a game object.
  • Fixed all ‘obsolete reference’ warnings from previous version of Unity.
  • Removed Interpolate rigidbody setting on destroyed prefabs and Time Slow (T) feature because of a known issue with Unity 5.6.
  • Fixed bug related to destructible objects that have destroyed prefabs which are also destructible (now recursively adds destroyed prefabs to the object pool).
  • Demo Scenes: When your HUD (“H”) or Reticle (“O”) was toggled off and you started the scene, you had to press these keys twice to toggle them on.
  • Added a null reference check to the Material Preloader in case you don’t supply a source material when adding a Material Replacement.

1.5.3 (February 2017)

New Features:

  • New HitEffects system. You can now specify different particle effects for each weapon/projectile type that hits an object. Also, you no longer need to place TagIt scripts on each collider that needs a different hit effect. You can now place a single HitEffects script on the parent and override individual colliders as needed. See the DestroyIt user guide for more info.

Minor Changes:

  • Removed many old/unused assets from the package, saving approximately 20MB.
  • Moved SUV Showcase demo scene to its own folder.
  • Added HitEffects to DestroyIt-Ready system, so HitEffects scripts can now be converted to stubs that can be packaged with your own commercial assets.

Bug Fixes:

  • Corrected several bullet hit particle effects and re-centered the wood splinter mesh’s center point.

1.5.1 (January 2017)

  • Corrected several bullet hit effect particle effects that were rotating on the ground
  • Recentered the wood splinter meshes center point

1.5 (December 2016)

We suggest that you delete your existing DestroyIt folder before importing the newer one, but please back up your project first!

Major Changes:

  • Updated for Unity 5.5.
  • Progressive damage system overhauled to allow more control of damage levels and visible damage.
  • Damage can now be repaired, and any damage level effects will turn off as the object is repaired.
  • For each Destructible object, you can now have from 1 to 10 Damage Levels, and the hit point range can be customized for each.
  • All Destructible objects now start with 5 pre-defined Damage Levels.
  • Destructible objects now automatically detect if they are damaged or destroyed based on current hit points, rather than relying on external ApplyDamage() or ProcessDestruction() calls.
  • Performance increased by reducing Garbage Collection allocation on PlayDamageLevelEffects, HeadsUpDisplay, ReleaseClinging Debris, Bullet Update() method, Object Pool Spawn() method, and by removing the JointCleanup script.

Minor Changes:

  • Damage masks extended from previously 5 levels of progressive damage to 10.

  • Many tooltips added to Destructible and DestructionManager script fields.

  • DestroyIt-Ready: You can now select a root folder in the Projects pane and click Convert Stubs to Destructible and it will find all prefabs under that folder.

  • DEMO SCENES

  • Removed unnecessary reflection probes and increased resolution of main reflection probe.

  • Bullet streak enhanced for a more visual, “tracer-like” effect.

  • Updated HUD UI to Unity Canvas.

  • ADDED: Performance, Keyboard/Mouse Controls, and Current Weapon sections to in-game HUD UI.

  • ADDED: Repair Wrench animated weapon with particle effect, to show off new Repair Damage feature.

  • DELETED: Some unused standard assets that were throwing warnings.

  • Changed to Linear lighting, tweaked tonemapping and blur camera settings, re-enabled light flares on SUV, changed reflection probes to baked lighting.

  • Removed “Draw Call Batching” scenario. Unity 5 now uses setpass calls and batches, making “draw calls” an inaccurate performance metric.

  • New cannon, repair wrench, and RPG models.

  • New brass pole, wall, longsword, and sconce models.

  • Mouse wheel can now be used to cycle through weapons.

  • Enhanced particle hit effects for metal, cloth, concrete, dirt, glass, and wood.

  • REMOVED: support for progressive damage on materials using legacy Unity 4 shaders.

  • REMOVED: Debug Monitor from Destructible script.

  • REMOVED: ForceCollisions script, it is no longer needed with Unity 5’s physics.

  • REMOVED: unused progressive damage mask images.

  • Destructible custom editor script re-categorized, and fields moved to provide clarity.

  • Changed ApplyImpactDamage, ApplyExplosiveDamage, etc to ApplyDamage overload methods.

  • Refactored Damage types so they inherit from a generic Damage interface.

  • ADDED: Repaired event that fires when a Destructible object is repaired.

  • ADDED: Damaged event that fires when a Destructible object is Damaged.

  • ADDED: WhenDestroyedPlaySound.cs helper script for playing sounds when a destructible object is destroyed.

  • ADDED: WhenDamaged.cs helper script for taking action when a destructible object is damaged.

  • ADDED: WhenRepaired.cs helper script for taking action when a destructible object is repaired.

Bug Fixes:

  • DestroyIt-Ready: Converting stubs/destructibles on Unsaved Scene caused undesired scene save popup.
  • DestroyIt-Ready: Converting a game object and its prefab at the same time caused duplicate scripts to be added.
  • Destructible objects can no longer be damaged into negative hit points.
  • When rotating a Destructible object with Damage Effects, the Damage Effects particles and gizmos did not rotate with the object.

1.4.2 (April 2016)

  • FIXED: Editor scripts have been updated to use the EditorSceneManager introduced in Unity 5.3. This change was required for editors to save user modifications properly.

1.4.1 (April 2016)

  • Added: TagItStub script so you can make DestroyIt-Ready assets that use TagIt scripts.
  • Added: New option on Destructible script “Ignore Collisions Under Magnitude”, which is useful for things like destructible tires, which should ignore most small-to-medium collisions yet still take full damage from bullets.
  • Fixed: Particle systems will no longer have DamageMaterial scripts added to them at runtime. This was a bug introduced by adding SkinnedMeshRenderer support.
  • Sink Into Ground option on Destructible script is now only available if the Destructible object has a rigidbody.
  • Bullets and the Axe melee weapon will now ignore trigger colliders.
  • The Axe melee weapon will now ignore the CharacterController tagged as “Player”. This will prevent the player from hitting himself with the Axe.
  • Object Pool importing and saving improved. You can now import/save object pool files to different locations. When importing a file, it will now update existing objects in the pool instead of replacing all objects. Also added a Clear button to quickly remove all objects from the pool.

1.4 (March 2016)

  • Added: DestroyIt - Ready. You can now make your own DestroyIt objects for commercial purposes.
  • Added: Skinned Mesh Renderer support for non-organic skinned mesh renderer objects.
  • Fixed: Warnings for deprecated properties and methods from Unity 5.2 and 5.3
  • Fixed: Mouse cursor not immediately visible when running in Unity editor and pressing Esc.

1.3.5 (February 2016)

  • Fixed the Particle Alpha Blend (No Fog) shader for Unity 5.3, so textures using that shader no longer appear pink.

1.3.4 (August 2015)

  • Optimization: Destructible objects that also have destructible debris now get initialized properly when auto-pooled so there are no surprise Garbage Collection allocations at runtime.
  • Optimization: Removed Linq queries and string concatenation on HeadsUpDisplay script to minimize Garbage Collection allocation.
  • Optimization: Moved the code that sets the fallback particle material from FixedUpdate() to Initialize(), so it doesn’t have to happen at destruction time if autopooling is enabled.
  • Aesthetic Fix: Reflection probes on glass panes (Demo Scenarios #14 and #15) had intensity set too high.
  • Aesthetic Fix: Reflection probe anchor overrides on SUV doors were getting set to the window anchor overrides when destroyed.
  • Code was fixed so destroyed objects must have at least one matching TagIt tag in order to inherit their parent’s probe anchor override.

1.3.3 (June 2015)

  • Corrected the Roughness channel on the Metallic mask on the Destroyed Cog Box
  • Fixed an issue with Hinge Joints behaving erratically after the Unity 5.1 update. If you use DestroyIt’s Support Points in your project, you’ll notice it creates Fixed Joints now instead of Hinge Joints. NOTE: If your fixed joints ever seem “springy”, increase the Solver Iteration Count in your Project Settings to around 20 or 30 (the default is 6).
  • Fixed a crash related to Hinge Joints on the #13 Hinge Motor scenario in the demo scene. We noticed this crash after the Unity 5.1 update. It occurs because the OpenCloseChest script is trying to set the hinge motor target velocity after the game object is destroyed. Unity 4 did not have a problem with this, but Unity 5 does. To fix this issue, all joints are now immediately removed from destructible objects when they are destroyed.

1.3.2 (June 2015)
Note: Please make sure you update to Unity 5.1 before you update DestroyIt to 1.3.2.

  • Updated GameObjectExtensions.cs to change the variable name MaxBounce to bounciness due to the variable name changing in Unity 5.1.

1.3.1 (Apr 2015)

  • Fixed an NRE that could occur with the material preloader.

1.3 (Mar 2015)

THIS IS A MAJOR UPDATE - PLEASE CREATE A BACKUP COPY OF YOUR PROJECT IF YOU ARE UPGRADING FROM A PREVIOUS VERSION OF DESTROYIT.

The best way to upgrade is to delete the entire “DestroyIt - Core” folder and re-import the new version of DestroyIt. Be sure to copy out any materials you may have saved to the Material_Preload folder. Also, click “Save To File” on the Object Pool, so you can quickly reload any object pool entries you’ve added.

Unity 5 Fixes/Enhancements

  • Support added for progressive damage using the Unity 5 physically-based rendering Standard shaders. See documentation for instructions on how to use it.
  • Removed use of the ForceCollisions script, since fast-moving rigidbodies (like the cannonball) now correctly register collisions using Continuous collision detection on the rigidbody.
  • Destructible objects will automatically transfer any Reflection Probe Anchor to all mesh renderers on their destroyed prefabs.
  • The PoweredLight script now includes an optional “EmissiveOff” material, so you can have it turn off emission when the light goes out. This is illustrated in Scenario #10 “Power Sources” in the demo scene. When the light fixture becomes unpowered, the lampshade’s emission is turned off for added realism.
  • The legacy DestroyIt Progressive Damage shaders were updated so they no longer double light input values.

General Fixes/Enhancements

  • Support for melee weapons added. Fireman’s Axe was added to the demo scenes to help get you started adding your own melee weapons.
  • “DestroyItDebris” layer is now automatically created on project startup if it doesn’t already exist.
  • PoolAfter script - Added option to reset an object back to its original prefab state prior to re-pooling it. Useful for re-pooling destroyed objects.
  • A few particle effects were fixed: BulletStrikeWood and BulletStrikeConcrete were using the “stuffing” sprites by mistake. Color gradients were fixed on the BulletStrikeStuffing particle effect so now there’s a mixture of white and black bits.
  • Added a collision.contacts safety check to both HitEffect and DestructibleParent scripts.
  • Removed many user-supplied fields from the InputManager script and made it smarter about locating weapon positions on the First Person Controller.
  • On the Destructible script, under “Children to Un-Parent when Destroyed”, if you set a child to un-parent and then later move that child from under the destructible object, the reference to that object will be removed and it won’t try to unparent it.
  • Now if you add a duplicate item to the object pool, it will remove the duplicate automatically and log a message, telling you that the item already exists and what item number it is.
  • Singleton scripts (DestructionManager, ObjectPool, MaterialPreloader, etc) were upgraded from lazy to standard, so now they will instantiate themselves from the scene whenever they are first accessed. This means you no longer need to mess with Script Execution Order for DestroyIt.
  • Clinging debris is now always parented under the object it clings to. This creates a more solid joint and is better for performance than adding and managing hinge joints for every piece of clinging debris.
  • New “Sink into Ground” option on Destructible script. If checked, the object will sink into the ground instead of being destroyed into particles/debris.

Demo Scenes Fixes/Enhancements

  • Demo scenes are now setup to use Linear color space for more realistic lighting, since it’s available to everyone (it was a pro feature in Unity 4). To enable, go to Edit => Project Settings => Player and change Color Space to Linear.
  • Deprecated “lockCursor” code was changed to use new lockState enum in the demo scenes.
  • Hinge Joint break/torque strengths are very different in Unity 5, so we had to increase the strength of support points (from 23 or so to 750) to keep the wooden tower from collapsing.
  • The wooden chest (Scenario #13) was changed to WakeUp() the rigidbody on open/close so it would trigger the hinge motor to activate.
  • Gun muzzle flash and BulletStrikeMetal particle effects were adjusted (tint white level increased) because they looked dull under Linear Lighting.
  • Skybox fixed in SUV scene (textures had alpha but not marked as HDR).
  • Glass pane debris shards no longer use thicker beveled colliders to prevent them falling through the ground. Instead, they use thin colliders based on the mesh and collision detection was changed to Continuous Dynamic.
  • On the cogbox’s spinning cogs, removed the extra delay in the DelayedRigidbody script, since the new PhysX version handles collisions better and doesn’t send the cogs through the thin box on high-speed impact.
  • Nuke got a visual update via the tonemapping image effect on the camera. This blows white levels out and makes the scene look weird and high-contrast while the nuke is in effect.
  • Particle and flare color/alpha values had to be brightened for demo scene assets.

Known Issues (Unity 5 Related)

  • In the demo scenes, the mouse cursor flickers in the middle of the screen on Windows machines while in the editor ( Cursor Lockstate Troubles - Unity Engine - Unity Discussions ). This only happens in the editor, not once you’ve built your game.
  • When shooting the springy ground targets (scenarios #16 and #17) with the cannonball, the impact seems to be so great sometimes that it “pulls” the target up from the ground a bit and there’s a pause/freeze before it repositions the target and lets the physics continue. I think this is a hinge joint collision related issue.
  • The FadeOut script doesn’t work for Unity 5 standard shaders, and we haven’t been able to create a script that’s as simple to use for the new shaders because the way they strip out any feature that isn’t used at runtime. This means in order to get it to work with the standard shader, you would have to know to create a variant with Fade render mode and add that to your list of preloaded shader variants and also add the script to your destroyed objects, which is a bit much. We’re waiting for a solution or for a ShaderForge version of the standard shaders, so we can make our own fading shader, like we did in Unity 4.

1.2 (Jan 2015)

Enhancements

  • Added FadeOut script. When attached to a destroyed prefab, strips colliders and rigidbodies from debris after a set amount of time and fades them out with a transparent shader.
  • TGA texture files converted to .PNG format. (Saved 105 MB on the package download size.)
  • Added three new damage masks, “Random Growth”, to give you more variety for progressive damage.
  • Transparent Reflective progressive damage shaders were improved to enhance the look of the damage. This can be seen in the shattered glass effect in the demo scenes.
  • New shattered “safety” glass texture and normal map added.

Fixes

  • Changed “Debris” layer to “DestroyItDebris” to resolve a conflict with UFPS, which uses a layer by the same name but for a different purpose.
  • You can now save/load your ObjectPool entries if you have renamed your DestroyIt - Core folder.
  • HUD in the demo scenes can now be turned on/off independently of the targeting reticle.
  • Impact rigidbodies (like the cannonball) will now have their momentum correctly maintained when destroying an object as a particle effect.
  • Removed back face on Glass Pane in demo scene and fixed UV stretching issue on a couple of the broken shards. This also fixed the glass shards flickering when they fall.
  • Fixed a lighting issue with Specular progressive damage shader - it was darker than the Bumped Specular version.
  • Fixed Scenario #10 in demo scene, where sconce bulb was “flashing out” even when not tagged as Powered.

1.1 (Oct 2014)

Note: Damage-Level Particle Effects on the Destructible script was renamed to Damage Effects. You will need to re-assign damage-level effects in your projects if you have previously used this feature.

New Features

  • Chip-Away Debris Allows you to make debris cling to a solid core structure of your destroyed prefab. Useful for columns or walls that have solid rebar centers. Debris can be chipped away from the rebar once the object is destroyed.
  • Tag All Debris As… You can now tag all debris pieces automatically with the “Tag All Debris As” checkbox. Each piece of debris will be assigned the TagIt script with the appropriate tag when the Destructible object is destroyed.
  • Save/Load Object Pool Entries You can now save and load your Object Pool entries to a file with the new Save/Load buttons on the Object Pool editor.
  • Auto-Pool Destroyed Prefabs By default, destroyed prefabs will now be auto-added to the object pool when the scene starts. This has several performance benefits: materials are pre-transferred to the destroyed object, debris rigidbodies are pre-referenced, and debris is pre-tagged. You can turn this feature off if needed. For instance, if your destructible objects need their materials changed dynamically through gameplay.
  • Parent Under Object (ClingPoints) When selected, strips the rigidbodies off the debris piece and parents it under the object it clings to instead of using a hinge joint. Provides better performance and a rock-solid joint.
  • Re-parent to Destroyed Prefab Allows you to choose one or more children under the destructible object that will be re-parented under the destroyed prefab. This is useful for things like car doors that have a window child, which needs to be reparented under the destroyed prefab’s door. (See SUV Showcase scene)

Enhancements

  • Damage-Level Particle Effects were renamed Damage Effects, and can now be any game object, they don’t have to be a particle effect. This allows you to use any game object with (or without) a script as a Damage Effect, so you could for instance make an object shudder at a certain damage level, or do a post-processing effect of water droplets on the camera when a water barrel is destroyed at close range.
  • Added a Showcase SUV Scene that illustrates what’s possible with the many features of DestroyIt.
  • When trying to do material transfer, system now logs a warning if the material was not found in the Resources folder.
  • Support Points now display friendlier error messages when no collider is found on a gameobject with a support point.
  • Updated asset to support Unity 4.5.4.
  • Updated code to use the new Unity 4.5 GetComponentInParent() method, which significantly improved performance for recursive parent lookups.
  • Improved material transfer from undestroyed to destroyed prefab with the option to “auto-pool” the destroyed prefabs. This option pre-transfers the materials to the destroyed prefabs on game Start().
  • Improved performance by converting several “foreach” statements to standard “for” loops.
  • Improved performance by converting several critical path C# generic List members to standard arrays.
  • Improved performance by moving the GetComponentsInChildren() check for debris ClingPoints and rigidbodies to game Start() when using auto-pooled destroyed prefabs.
  • Added new particle effect for bullets striking rubber tires.
  • Added new particle effect for bullets striking cushion stuffing.
  • Added Damage Bumped Reflective shader.
  • Improved Transparent Reflective shader to better handle curved glass.

Bug Fix

  • Destructible script no longer throws exception when assigning multiple replacements for the same material. It logs a warning instead and skips that material replacement at runtime.

----
1.01 Hotfix (Jul 2014)

  • FIXED: When dragging Destructible script onto a gameobject, receive multiple null reference exceptions from Destructible and DestructibleEditor scripts.

DestroyIt 1.0 (Jul 2014)

  • Initial release

User Guide | Website | Demo |Youtube | Additional Screenshots

5 Likes

Woooo! :hushed:
Bookmarked…

This looks cool! :stuck_out_tongue: How do u compare it to the other two though? the other destruction systems>

What’s the performance like?

Thanks! (I’m the other half of the DestroyIt team, btw.)

I’m not sure which two assets you’re comparing ours to, but from my experience, there are only 4 ways to handle destruction of an object in Unity (ordered from highest performance cost to lowest):

  • Swap the object out with a pre-fragmented, destroyed prefab
  • Fragment the object at runtime (ie, a mesh cutter script)
  • Swap the object out with a particle effect
  • Remove the object from the game (no visual effect)

#1 creates the best effect if you can handle the performance cost. You get realistic, persistent debris that looks great, casts shadows, can be interacted with, can be further destroyed, can cause damage, and tricky objects like trees and barrels break apart perfectly. The downside to this method is (A) you have to create those cool destroyed prefabs with a modeling tool, and (B) it quickly becomes a performance hog with all the persistent colliders and rigidbodies.

#2 is a compromise for the sake of convenience. You get most of the benefits of #1, but the meshes are sliced up on the fly, so you don’t have to create broken prefabs with a modeling tool. The downside with this method is (A) it can become a performance hog like #1, but even worse because it’s doing a lot of work at destruction time (B) the mesh cutting is done via algorithm, so objects break into a voronoi or similar pattern, so it doesn’t look realistic for tricky objects (ie, trees explode into chunks, barrels break into “closed” chunks instead of thin fragments, etc).

#3 is a compromise for the sake of performance. You don’t get persistent debris, but you can get some nice looking effects, since you can design mesh particles that look like fragments of the destroyed object. The benefit to this method is great performance. The downside to this method is (A) no persistent debris, (B) you still have to create those cool looking particle effects, and (C) it’s not realistic for tricky objects (like a destroyed tree popping into a particle effect).

#4 is the ultimate compromise for the sake performance. You get nothing when the object is destroyed, it just disappears right in front of your face. Sounds terrible, but it’s still an option for certain situations. For example, you’re not going to notice destruction happening in the distance when you’re surrounded by smoke and flying debris in your face. The benefit to this method is ultimate performance. The downside is complete lack of realism, so you want to hide this type of destruction from the camera as much as possible.

Now, to answer your question, the DestroyIt system doesn’t rely on a single strategy for destruction. It uses #1, #3, and #4. It has a destruction manager to process destroyed prefabs and throttle them down to particle effects when destruction is heavy, while thinning out excess debris (you set the limit). It has a particle manager to throttle particle effects when destruction is heavy. And it uses object pooling to handle spawning and recycling objects instead of instantiating/destroying them directly.

Our focus with DestroyIt is:

  • Large amount of destruction (high performance)
  • Realistic destruction (wood breaks like wood, glass like glass)
  • Destruction that matters (collapse towers by knocking out their supports, kill an enemy with a fallen tree, etc)

So with that information, you can compare our system to any other and make an informed choice. I would suggest playing our web demo to see all the scenarios DestroyIt handles. Plus, it’s just fun to run around and blow stuff up. :slight_smile:

So basically this can be applied to any mesh and it handles the rest of the work for you in a configurable manner? Does it auto generate the broken pieces?

Hey pneill,

Performance and realistic/cinematic effects were our top two design goals. The trade-off between those two is the heart of the DestroyIt system.

We think performance is great, but more importantly, it’s customizable to your game. So if your game is targeting low-end machines, you can adjust the performance down so fewer destroyed prefabs are spawned during heavy destruction and more will fall back to particle effects. And if it’s still too heavy, you can adjust the particle manager to throttle the number of particle effects more aggressively. You could also limit destroyed prefabs to only spawn when within distance from the camera. So there’s a lot of performance tweaking available. That being said, we haven’t tested DestroyIt for mobile devices.

Performance Notes:

In our trailer video, we setup a scene with 176 decorative columns and destroyed them all with the nuke’s shockwave. The framerate on our moderate gaming rig dropped to 40 fps for a couple of frames, but it was not a noticeable lag in person. The decorative columns even have mesh colliders on them, and are not really optimized for mass destruction. We probably could have destroyed more with a more optimized model. Still, it’s a pretty good idea of the limits.

Also, in our web demo, you can use the ‘Q’ key to switch to the nuke and blow everything up in the scene all at once. That should give you a good idea of how performance is for your system, and whether it would be sufficient for your project.

The only way it does that is if all you want are particle effects. The asset comes with a set of default particles you can use. (Check out demo scenario #1). If you want more complex particle effects, or destroyed prefabs, your artist will need to create them.

No, it doesn’t do that. You’ll need to make a destroyed version of your object in a 3D modeling tool. Most 3D modeling tools have auto-fracturing add-ons, including Blender. All the scenarios in the demo after #3 use prefabs.

We’re also working on our first add-on model pack, a fully destructible, completely modular, modern residential house. It should be available in a few weeks.

how can i make my fps player prefab to destroy your prefabs? not realy clear in the doc´s no capitel to setup the waepon or what else to shoot and destroy it with different weapons? mean new weapons!

greetz Reiner

Can you recommend any specific ones for Blender? One potential issue with having to do that in a modeling tool is that I use mostly purchased models and have had very mixed results trying to import some of them into Blender.

I’m currently using the Exploder asset, which fractures meshes automatically and even UV’s the new edges, but I would like to see if DestroyIt would work better for my game in terms of performance and working more reliably. Would you say that DestroyIt is a good fit for blowing up space ships in zero G? (sounds like it would be fine)

We use modo, so I’m only vaguely familiar with Blender. I have version 2.69 installed, and it includes a Cell Fracture button, but I don’t know how to use it. I found a couple of tutorials online that might point the way.

DestroyIt would be an excellent fit for blowing up space ships! The way I’d probably do it is similar to what we did with the cog boxes in the demo (scenarios #11 & #12). The undestroyed version is just a rectangular cube, but the destroyed version has extra cogs and drive shafts packed inside.

For a destroyed spaceship prefab, I’d slice the model along weak joints, give the metal a bit of a twist, put a texture on the interior polygons (something like black with glowing heated metal areas), and then pack a bunch of sci-fi greebles inside that’ll fly out when it explodes.

If you want to blow up parts of the ship separately (like destroy the wings separate from the body), you just need to put the script on each mesh instead of the parent object (in the demo, scenario #8, multiple meshes).

Hey Reiner,

Sorry, but I’m not sure what you’re asking, specifically. We didn’t document the weapons setup because they’re not really the focus of the asset - just bonus goodies. :slight_smile:

Are you asking what you would need to do in order for your game’s weapons to damage DestroyIt objects? If so, then what you need to do is make your ammo deal damage to DestroyIt objects on collision by calling ApplyExplosiveDamage() or ApplyImpactDamage() on the Destructible object, and telling it how much damage, force, etc to apply. Destructible objects have a set number of hit points, so once you apply enough damage to them, they will destroy themselves.

In your OnCollisionEnter (or Update, if you ammo doesn’t have a rigidbody, like the Bullet prefab in DestroyIt):

private void OnCollisionEnter(Collision collision)
{
    // Apply damage if the object hit was a Destructible object
    Destructible destructible = collision.contacts[0].otherCollider.gameObject.GetComponent<Destructible>();
    if (destructible != null)
    {
        ImpactInfo bulletImpact = new ImpactInfo() {Damage=20, AdditionalForce=15, AdditionalForcePosition=hitInfo.point, AdditionalForceRadius = .5F};
        destructible.ApplyImpactDamage(bulletImpact);
    }
}

General Info about the DestroyIt Weapons:
The weapons are model prefabs that are parented under the player’s gameobject. There’s an InputManager script that handles all input for the demo, and acts as the brains for firing the weapons. Once fired, each ammo prefab also has a small script that handles collisions, bullet streaks, rocket physics, dust effects (for the nuke), etc.

Is there anything in particular you would like to see documented about the weapons?

exactly what I was looking for. will test it now

thank you for the quick response

greetz Reiner

Hey guys,

We found a bug in the Destructible script and custom editor, and have submitted a hotfix update. Here’s the change:

v1.01 Hotfix
FIXED: When dragging Destructible script onto a gameobject, you receive multiple null reference exceptions from Destructible and DestructibleEditor scripts when interacting with it in the Inspector.

The reason this was happening is because the DamageLevelParticles and UnparentOnDestroy collections were not properly initialized before being iterated over in the custom editor.

Hello, I just bought your asset, and for moment I am not happy with it.

I only put 3 cubes in my game with differents sizes, and when I click on a button I destroy all cubes, result :
The size is always the same, no realist.

It sounds like you’re describing scenario #1 in the demo scene, where you add the destructible script to an object without any additional changes. Am I understanding the problem? The destructible script uses the DefaultLargeParticle or DefaultSmallParticle particle effects (based on whether the object is greater or less than one meter). It offers a quick solution, but it’s the least realistic. It’s mostly intended as a placeholder effect until you have your real particle effects or destroyed meshes ready, to give you something visual.

Dang, just found out about this today, judging from the demo this is awesome and very quick to get prototyping, wish I would have known about it before I bought another destruction system.

Yes, I understood your script, I modify the maximumsize, 0.5 it’s better.
Now my problem is when my character walk, and touch your column, the column explode.
I added 4 cubes around the column, and now only bullet can touch the column and destroy it.

On mobile when your column pass to the destroyeed prefab Column Marble DEST, it’s very laggy, I am working on.

I also add a sound to your “one mat - middle chunk” with a simple script :

public class destructionSound : MonoBehaviour {

public AudioClip sound;
// Use this for initialization

void OnCollisionEnter(Collision collision) {
if (collision.relativeVelocity.magnitude > 2)
audio.Play();
}
}

Hey Ghosthowl,

Thanks for the kind words. Depending on which destruction system you bought, you might find it works well with ours, both complementing each other. For example, some of the destruction systems use mesh cutting algorithms, which would give you another destruction option for certain circumstances. Likewise, if your system breaks 3D models into debris pieces, those prefabs can be used as the destroyed prefabs in DestroyIt.

Hey menfou,

I’m out of town until tomorrow evening. When I get home I’ll do my best to address the issues you mentioned. In the meantime, can you tell me what character controller system you are using?