Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

[Released] DestroyIt - Cinematic Destruction System

Discussion in 'Assets and Asset Store' started by DeadlyAccurate, Jun 14, 2014.

  1. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    173
    There's no specific documentation for any one particular demo scene object, but I might be able to help. What are you trying to do?
     
  2. bearlike

    bearlike

    Joined:
    Mar 11, 2016
    Posts:
    6
    Hi, I saw a nuke effect in your video, but I can't find the nuke effect in the web demo. If I buy this asset, would it have the nuke effect?
     
  3. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    173
    Yes, the nuke is included in DestroyIt. I'm not sure why we removed it from the web demo, but it is part of the package.
     
  4. Salja

    Salja

    Joined:
    Mar 23, 2017
    Posts:
    322

    Attached Files:

    Last edited: Apr 1, 2019
    tosvus likes this.
  5. Salja

    Salja

    Joined:
    Mar 23, 2017
    Posts:
    322
    Hey, i get a error if i create a build some ideas ?

    Screenshot_2.png
     
  6. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    173
    Delete the "Extras (safe to delete)" folder and its contents. Those files are only for DestroyIt-Ready objects and aren't intended to be part of a final build.
     
  7. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    173
    We're just starting to test DestroyIt with Unity 2019.1, but if you try it out yourself and get the following compiler error:

    D:/Workspace/DestroyIt - Collab/Library/PackageCache/com.unity.textmeshpro@2.0.0/Scripts/Runtime/TMPro_UGUI_Private.cs(2028,130): error CS1644: Feature `out variable declaration' cannot be used because it is not part of the C# 4.0 language specification​

    ...change your Scripting Runtime Version to .NET 4.x Equivalent.

    Edit --> Project Settings --> Player --> Other Settings (Configuration).

    You'll need to restart the editor when it asks you to.
     
    tosvus and DragonmoN like this.
  8. tosvus

    tosvus

    Joined:
    Dec 27, 2016
    Posts:
    38
    Hi, how accurate is it possible to be when destroying with say a sword? (think slicing like in fruit ninja, I suppose). Thanks!
     
  9. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    173
    It's not a mesh-slicing system. You provide the destructible prefab (either mesh or particles or both) in advance.
     
  10. tosvus

    tosvus

    Joined:
    Dec 27, 2016
    Posts:
    38
    Ok, thanks!
     
  11. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    173
    Someone on Youtube asked if DestroyIt worked with the HD Rendering Pipeline, and I thought I'd post the answer here in case anyone else wanted to know the answer.
    DestroyIt works with the HDRP system, but progressive damage doesn't work, and the HDRP system doesn't have any particle shaders yet, so destroying anything into particles causes pink boxes to appear. If you have a workaround for HDRP particle shaders (and terrain shaders, which were also pink after the conversion), the steps for converting are here: https://docs.unity3d.com/Packages/com.unity.render-pipelines.high-definition@6.7/manual/Upgrading-To-HDRP.html
    Once HDRP is integrated into Unity officially (not a Preview version), we'll look at making progressive damage work for it.
     
  12. Michael2D

    Michael2D

    Joined:
    Mar 5, 2014
    Posts:
    17
    Hi
    Could you help me to make this work on MFPS?

    I have no idea how to set up damage system there.. To objects

    Thank you
     
  13. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    173
    We've contacted Lovatto Studio for a voucher for MFPS. We'll let you know if they get back to us.
     
    julianr likes this.
  14. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    173
    OK, they got back to us with a voucher, so we'll take a look at it as soon as we can.
     
  15. Michael2D

    Michael2D

    Joined:
    Mar 5, 2014
    Posts:
    17
    Thank you very much!
     
  16. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    196
    Here is a step-by-step guide to using DestroyIt with MFPS 2.0 for multiplayer destruction.

    (1) Import MFPS 2.0 Multiplayer FPS
    (2) Open the \MFPS\Scenes\ExampleLevel scene
    (3) Import Photon PUN 2 (Free)
    (4) Login to Photon Cloud, setup a new Photon PUN project, and copy the AppId into the PUN Wizard

    (5) Import DestroyIt
    (6) From the top menu, choose Window => DestroyIt => Setup - Minimal

    (7) From the \DestroyIt\Demos (safe to delete)\Prefabs\Destructible Objects\Pristine folder, drag the Column prefab into the ExampleLevel scene

    (8) Select the Column game object in the Hierarchy and choose Add Component => Photon View
    (9) Drag the Column game object to the Observed Components field, and check the Synchronize Position and Rotation checkboxes on the Photon Transform View component

    (10) Open the \DestroyIt\Scripts\Behaviors\Destructible.cs script and add the [Photon.Pun.PunRPC] attribute to the ApplyDamage method
    Destructible.cs

    (11) Open the \MFPS\Scripts\Weapon\bl_Bullet.cs script and add the section of code below to the OnHit method
    Code (CSharp):
    1. DestroyIt.Destructible destObj = hit.collider.gameObject.GetComponentInParent<DestroyIt.Destructible>();
    2. if (destObj != null)
    3. {
    4.     PhotonView pv = destObj.GetComponent<PhotonView>();
    5.     pv.RPC("ApplyDamage", RpcTarget.All, damage);
    6. }
    bl_Bullet.cs

    (12) Save all your changes to the scripts and the ExampleLevel scene

    Note: The instructions provided below are if you want to test multiplayer destruction in your scene with another developer. Each developer on your team will need MFPS 2.0 and DestroyIt and have them imported into the project as outlined in steps 1-5 above.

    (13) Export your changes into an asset package. Use CTRL-click to select the ExampleLevel scene and the two scripts you modified, right-click and choose Export Package. Uncheck Include Dependencies so only the modified files are included.
    (14) Have your developer friend delete his/her ExampleLevel scene, and import your package so you are both running the same code.
    (15) Run the scene, and have your friend also run the scene on their computer. Note that they will also need to use the same Photon AppId as you.
    (16) From the in-game menu, create a new server and Join. Your friend should join the other side. Now when either of you damage or destroy the destructible column with a bullet, you will each see progressive damage and the particle effect.



    From here, you could expand your damage checking to knife cuts or grenades/molotov cocktails, so those also damage DestroyIt destructible objects. You could also try using a more advanced destructible object, one that has damage effects like smoke or sparks, or one that leaves persistent debris from a destroyed prefab. In the case of persistent debris, you might want to make the debris pieces observable to Photon by adding Photon View components to each of them and syncing the position/rotation. Or you might decide that you like persistent debris but don't want to worry about syncing each piece with all clients, to save network traffic. It really depends on if the position of each piece of debris is important to track in you game or not. If flying debris can damage players, block movement (ie, a cave collapse), or provide cover, then you probably want to track its position/rotation for all clients.
     
    Last edited: Aug 11, 2019
  17. Michael2D

    Michael2D

    Joined:
    Mar 5, 2014
    Posts:
    17




    Thank you so much! Everything is working perfectly. I already made thesystem to damage/kill player from big buildings. Your system is just perfect for destruction.

    Thank you again.

    Iam definitely going to buy this package again to support you!
     
  18. prolixe

    prolixe

    Joined:
    Jun 27, 2018
    Posts:
    6
    Hello,

    I'm making a FPS whit MFPS, so whit photon,and i'm using Unity 2019.2.8f1 HDRP and Destroyit 1.10.1

    All working well whit the HDRP ..

    Just put all your materials whit standard shader
    and
    in Edit - Render Pipeline - Upgrade project material to hight definition .

    You need to reworking the transparent materials using unlit for transparent or using Alpha Clipping for material decal and it's good..

    well..
    I have made some destructible objects, some barrel, glass, light etc..they're working ..

    Where i get a serious problem it is when the match is finished and coming the reloading of the map,
    In using MFPS we using Photon and the map is reloading each time the game is finished but more quickly ..
    Its Deathmatch CTF TDM Game when the map is reloading i need the destructed objects are back to they're initial state

    I can't find how to do it .. I tryed pooling but not working they just disseaper, i tryed whit SpawnObject and cant do it
    they are destroyed but they are not back when the game is finished and when the map is reloaded they are again destructed..

    Have you a solution for this one ?

    Thank you !
     
  19. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    196
    Hi prolixe,

    In the demo scene we provide with the Unity package, we are reloading the scene when you press 'R', and also when you switch scenes - for instance when you go to the SUV Showcase scene and then back to the Main Scenarios scene.

    The scene switching just does a simple LoadScene operation, and the destructible object are all reset back to their original states:
    Code (CSharp):
    1. SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    Are you using a different method to reload your scenes? Because it seems like reloading the scene as you mentioned should reset the destructible objects fine.
     
  20. prolixe

    prolixe

    Joined:
    Jun 27, 2018
    Posts:
    6
    The reset R it is what i searched for add it in the relaunch yup..

    The coding is not my best part.. i'm better to map making.. : )

    I find this.. but i don't know if that the cause of not reloading ..i'm looking for now ..

    Code (CSharp):
    1.     public static void LoadLevel(string scene)
    2.     {
    3.         SceneManager.LoadSceneAsync(scene, LoadSceneMode.Single);
    4.     }
    5.  
    6.     public static void LoadLevel(int scene)
    7.     {
    8.         SceneManager.LoadSceneAsync(scene, LoadSceneMode.Single);
    9.     }
    Maybe its because its loaded Async ?

    Thank you for the quick responding !
     
  21. prolixe

    prolixe

    Joined:
    Jun 27, 2018
    Posts:
    6
    Maybe because the endif at start..

    Code (CSharp):
    1. using UnityEngine;
    2. using System.Collections;
    3. #if UNITY_EDITOR
    4. using UnityEditor;
    5. #endif
    6. using UnityEngine.SceneManagement;
    7. #if UNITY_EDITOR && UNITY_EDITOR_WIN
    8. using System.IO;
    9. #endif
    10. using Photon.Pun;
    11. using Photon.Realtime;
    12.  
    13. public class bl_UtilityHelper
    14. {
    15.  
    16.     public static void LoadLevel(string scene)
    17.     {
    18.         SceneManager.LoadSceneAsync(scene, LoadSceneMode.Single);
    19.     }
    20.  
    21.     public static void LoadLevel(int scene)
    22.     {
    23.         SceneManager.LoadSceneAsync(scene, LoadSceneMode.Single);
    24.     }
     
  22. prolixe

    prolixe

    Joined:
    Jun 27, 2018
    Posts:
    6
    In PhotonPunClass i find this :

    Code (CSharp):
    1.  - 916 -
    2.  
    3.   public class SceneManagerHelper
    4.     {
    5.         public static string ActiveSceneName
    6.         {
    7.             get
    8.             {
    9.                 Scene s = SceneManager.GetActiveScene();
    10.                 return s.name;
    11.              
    12.             }
    13.         }
    14.  
    15.         public static int ActiveSceneBuildIndex
    16.         {
    17.             get { return SceneManager.GetActiveScene().buildIndex; }
    18.         }
    19.  
    20.  
    21.         #if UNITY_EDITOR
    22.         /// <summary>In Editor, we can access the active scene's name.</summary>
    23.         public static string EditorActiveSceneName
    24.         {
    25.             get { return SceneManager.GetActiveScene().name; }
    26.         }
    27.         #endif
    28.     }
    29.  
    30. - 941 -
    Bha idk where to put your code ..For now i can't help myself x ) but it look photon using method for loading scene and mfps using method from photon .. its out of my skill : )
     
  23. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    196
    @prolixie,

    Thank you for providing extra details regarding the issue you're having.

    We'll try to setup a similar scenario using MFPS and Photon PUN and go through the Deathmatch CTF TDM game (if possible), and see if we can reproduce the issue when the map reloads. Hopefully we'll have additional info or a solution for you soon.

    In the meantime, if you think of any addition details that would help us quickly setup a scenario to reproduce the issue, please let us know. We have MFPS, Photon PUN, and DestroyIt, so we should be able to setup a similar test scenario.
     
  24. prolixe

    prolixe

    Joined:
    Jun 27, 2018
    Posts:
    6
    Hello !
    For reproduce it just :
    Add destructible object in example map.
    Make a server whit select "Game per round"
    Launch the game, destruct the objet wait the round is finish : )

    I find this in bl_RoundTime :

    Code (CSharp):
    1.     public void StartNewRoundAndKeepData()
    2.     {
    3.      
    4.         GetTime(true);
    5.         isFinish = false;
    6.         if (RoomMenu != null)
    7.         {
    8.             RoomMenu.isFinish = false;
    9.             RoomMenu.isPlaying = false;
    10.             bl_UtilityHelper.LockCursor(false);
    11.         }
    12.         m_Manager.SpawnPlayer(PhotonNetwork.LocalPlayer.GetPlayerTeam());
    13.        
    14.     }
    Hope you will get a better result of mine..

    Thank you
     
    Last edited: Oct 18, 2019
  25. zangad

    zangad

    Joined:
    Nov 17, 2012
    Posts:
    196
    Hey prolixe,

    Thanks for the extra details regarding reproducing the issue, it helped me a lot. First off, a couple of things I discovered while working on this issue:

    1) The StartNewRoundAndKeepData() method doesn't seem to be used at all. I couldn't find any code references to it, and when I put a breakpoint in the method, it was never hit. So I'm not sure what that method is for, but it doesn't seem to be used.

    2) What is used to reset the scene is bl_RoomSettings.ResetRoom(). The way it is setup, though, it only resets player and score data for PUN - it doesn't actually reload the scene. That's why the destructible objects are never reset. Not reloading the scene means your levels can only ever have static (non-modifiable) objects in them. Optionally, you could programmatically add the objects to your scene, but that would be fairly tedious and require more programming.

    3) However, I found a place where you can reload the scene that seems to work: right before resetting the room. Now, I don't know if this is the preferred method for resetting a level in MFPS, but I'll share my changes in the hopes that it will at least get you past where you're stuck.

    NOTE: I would advise contacting Lovatto Studio and asking them what is the best way to reload a dynamic (non-static) scene with MFPS 2.0. Be sure to mention that you are removing objects from the scene and need to reload the scene after a match in order to reset everything. They should be able to tell you the best way to do that for their asset.

    Having said that, here's what worked for me:

    1) Open the bl_RoundTime.cs script. Paste this using statement at the top:
    Code (CSharp):
    1. using UnityEngine.SceneManagement;
    2) In bl_RoundTime.cs, scroll down to the FinishGame() method. Look for the line that says "if (RoomSettings)". Change that section of code to this:
    Code (CSharp):
    1. if (RoomSettings)
    2. {
    3.     SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    4.     RoomSettings.ResetRoom();
    5. }
    Essentially, all we are doing is adding the code to reload the scene before it resets the room. But once I did that, things started working. Here a video of me running through the Game Per Round mode and destroying the destructible column a couple of times:

     
  26. prolixe

    prolixe

    Joined:
    Jun 27, 2018
    Posts:
    6
    Hello Zangad,

    Well..Thank you a lot for this one !
    If you are ok i'll share this in the Mfps forum in hope you will get some news customers : )
    I tryed your method and its working well, for showing correctly the stats in the finished screen i put the load scene after the reset setting
    Thank you a lot for the support, and the time.

    Code (CSharp):
    1.   GetTime(true);
    2.             if (RoomSettings)
    3.             {              
    4.                 RoomSettings.ResetRoom();
    5.                 SceneManager.LoadScene(SceneManager.GetActiveScene().name);
    6.             }
    7.             isFinish = false;
     
    zangad and DeadlyAccurate like this.
  27. DeadlyAccurate

    DeadlyAccurate

    Joined:
    Apr 2, 2013
    Posts:
    173
    Absolutely! Thanks, and we're glad everything is working for you!