Search Unity

  1. Check out the Unite LA keynote for updates on the Visual Effect Editor, the FPS Sample, ECS, Unity for Film and more! Watch it now!
    Dismiss Notice
  2. The Unity Pro & Visual Studio Professional Bundle gives you the tools you need to develop faster & collaborate more efficiently. Learn more.
    Dismiss Notice
  3. Improved Prefab workflow (includes Nested Prefabs!), 2D isometric Tilemap and more! Get the 2018.3 Beta now.
    Dismiss Notice
  4. Improve your Unity skills with a certified instructor in a private, interactive classroom. Watch the overview now.
    Dismiss Notice
  5. Want to see the most recent patch releases? Take a peek at the patch release page.
    Dismiss Notice

Detonator Explosion System

Discussion in 'Assets and Asset Store' started by benthroop, Jul 29, 2014.

  1. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    103
    Back in 2009 I wrote the Detonator Explosion System and it's been used in a lot of Unity projects. In fact if you look at the URL it was apparently the very first asset that Unity submitted to the Asset Store.

    However that was a really long time ago, especially in Unity years! Well recently I have been able to dedicate some time to maintaining it and this thread will serve as my contact point with the community.

    Please post any bug reports and feature requests in this thread. Thanks!

    EDIT 9/22/2014 - Detonator 1.23 for Unity 4.x is live in the Asset Store
    Asset Store Link: https://www.assetstore.unity3d.com/en/#!/content/1

    NOTE: The new minimum version is Unity 4.0.0, not 4.5.3. This should help some people out.
     
    Last edited: Sep 22, 2014
  2. DoctorJellyface

    DoctorJellyface

    Joined:
    Nov 6, 2012
    Posts:
    73
    Downloaded this link, but the problem with normal maps continue.
     
  3. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    103
    Dr Jellyface - try the version that was just posted to the Asset Store, or grab it via the Dropbox link in the first post.
     
  4. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    797
    Thanks very much for this awesome asset.

    The update I just grabbed from the asset store did not complain about normal maps not being flagged correctly.

    There is one issue I'm not sure how to address. When you click on the cube wall to trigger an explosion, there's a brief pink flash coming from the click point.

    This was happening in the previous version as well.

    I've attached a screenshot.

    I'm guessing there's a material not setup correctly or maybe a missing texture.

    How do I correct this?
     

    Attached Files:

  5. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    103
    Schmosef, are you in Unity free by any chance? That might be the heatwave which requires render to texture. I didn't test on free... maybe I should. Anyway, try grabbing that Dropbox link at the top of the thread. I reassigned the materials in Unity 4.0 so it might work better now. Let me know.
     
  6. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    797
    Nope, I'm on Pro.

    I'll try the drop box link and let you know if it's any better.
     
  7. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    797
    Ok, I tried it. The pink is the same.

    I forgot to mention before that if you reduce the detail level slider by about 10% the pink flash goes away.
     
  8. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    797
    I just did a build for Windows Store. It works!

    There's no pink flash either.

    It's kind of slow on my Tegra 3 based SurfaceRT, but it works.
     
  9. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    103
    So it works in your build but you still get pink in the editor? You should be able to tell what object it is by pausing the game and selecting it. Let me know which object it is if you can. Thanks!
     
  10. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    797
    Sorry, I should have thought of that. It looks like the "Heatwave" object.
     

    Attached Files:

  11. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    797
    Just following up because it would be great to get this working.

    When I look at the HeatDistort shader in the inspector, the attached error is displayed.

    I'm guessing that this is what's causing the pink flash. My graphics card is an nVidia 660GTX. Maybe you have an AMD based card?

    Is there anything I can do to fix the shader or remove the pink flash?
     

    Attached Files:

  12. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    103
    Schmosef, there's a new version up. Give that a shot? Sorry for the issues. I have an Nvidia based card as well (750m).
     
  13. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    797
    I tried the new version yesterday. Same issue with the shader.

    Is there a way to disable it?
     
  14. Novack

    Novack

    Joined:
    Oct 28, 2009
    Posts:
    518
    This means now Detonator works using the new particle system?
     
  15. ZJP

    ZJP

    Joined:
    Jan 22, 2010
    Posts:
    2,645
    Good question.
     
  16. ThiefMaster

    ThiefMaster

    Joined:
    Sep 21, 2014
    Posts:
    1
    I tried adding some explosions to the 2D game created in this tutorial. However, the explosions always appear behind the decoration. I tried playing around with the Z value and also tried setting the sortingLayerName in code but neither worked. Any ideas what could be causing this?
     
  17. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    103
    @Novack - Detonator still uses the legacy particle system.

    @ThiefMaster - Detonator creates a lot of child objects that don't inherit their layer from the parent Detonator object. This is lame and a good feature for next release. I've attached a patched Detonator.cs that will do this. Replace the current Detonator.cs and you should be able to set the layer of the parent object it will inherit. Let me know how it goes.
     

    Attached Files:

  18. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    797
    Am I the only one having trouble with the heatwave shader?
     
  19. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    103
    @schmosef - are you on Unity free? What is your video card?
     
  20. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    797
    I'm on a Unity Pro subscription. My card is an NVidia 660 GTX.
     
  21. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    103
    Hmm... can you go make a new project, redownload the package through the asset store, import it, and tell me if you still get the pink. Specifically, you should NOT get the warnings about texture import when you import the package. If you do, then somehow you've still got an old version. Let me know how that goes.
     
  22. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    797
    Sure, I'll try it now.
     
  23. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    797
    I tried a new project and I had the same problem.

    The issue is not with texture importing. It's with the HeatDistort shader.

    I found this thread with other people talking about the same problem. I made the shader code change suggested by @Chronixxas and it seems to work.
     
  24. LaneFox

    LaneFox

    Joined:
    Jun 29, 2011
    Posts:
    6,130
    You simply need to remove the .xyw

    Old code:
    Code (csharp):
    1. half4 col = tex2Dproj( _GrabTexture, i.uvgrab.xyw );
    New code:
    Code (csharp):
    1. half4 col = tex2Dproj( _GrabTexture, i.uvgrab );
     
    bulathard likes this.
  25. JeevanjotSingh

    JeevanjotSingh

    Joined:
    Apr 30, 2014
    Posts:
    251
    can i use them commercially in my game for free?
     
  26. JeevanjotSingh

    JeevanjotSingh

    Joined:
    Apr 30, 2014
    Posts:
    251
    and will you share with us in which tool you created them and how?
     
  27. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    103
    Yes, like all other Asset Store assets, you can use it for free and even without attribution.
     
    Jenifer_Jane likes this.
  28. JeevanjotSingh

    JeevanjotSingh

    Joined:
    Apr 30, 2014
    Posts:
    251
    I am very glad by listing this reply .
    Thanks for making such a great think like this .
    Keep up the good work!
     
  29. unwitty

    unwitty

    Joined:
    Jan 18, 2015
    Posts:
    31
    Thanks for making this! This has saved me several hours of work to get good looking explosions!

    Any ideas on rotating the Detonator-Upwards prefab so that the plume is in a direction other than world up?
     
  30. benthroop

    benthroop

    Joined:
    Jan 5, 2007
    Posts:
    103
    On the main Detonator component there is a checkbox "Use World Space". I think that will work but I haven't tested it in a long time!
     
  31. unwitty

    unwitty

    Joined:
    Jan 18, 2015
    Posts:
    31
    Will play around with it some more. Thanks again!
     
  32. djoshi

    djoshi

    Joined:
    Mar 28, 2014
    Posts:
    180
    Is this compatible & smooth on mobile platforms?
     
    fschneider likes this.
  33. unwitty

    unwitty

    Joined:
    Jan 18, 2015
    Posts:
    31
    For the love of me, I can't remove the explosion force. I don't want the explosion to be affecting the rigidbodies at all, and I've even gone as far as removing all lines of code involving the keyword "force."

    I still can't get it to not push/blow away objects!

    Help.
     
  34. omgitisunity

    omgitisunity

    Joined:
    Jul 17, 2013
    Posts:
    2
    Hi all,

    I ran into the same pink plane problem, google took me here, I fixed issue by changing the line to
    1. half4 col = tex2Dproj( _GrabTexture, i.uvgrab );
    However, it seems it only render quarter (or half) of the heatwave!? I've tried this fix and the 2-line fix in another thread but still only show a portion of it. Please see the attached image. This is an awesome demo, thanks so much for putting this together!!! Please help me with the final step, how do I get it to show the whole heatwave like the one in the demo, many many thanks!

    best,
    quarterHeatwave.gif
     
    Last edited: Mar 6, 2015
  35. pwhiteside

    pwhiteside

    Joined:
    Mar 10, 2015
    Posts:
    1
    Noob question: how are the collisions done? I have poked around but can't seem to find the collider or whatever.
    Using Unity 5 Free version.
     
  36. Zmey

    Zmey

    Joined:
    Nov 28, 2013
    Posts:
    2
    small bug : Camera.main not always assigned, for example in multi camera setup
     
    Schoolie440 likes this.
  37. fschneider

    fschneider

    Joined:
    May 26, 2014
    Posts:
    42
    First of all, great work! I currently have two questions:

    1. How is the performance on mobile devices?
    2. The spray always seems to fly towards the main cam. This looked awkwards in situations where I scaled up the whole component and moved the cam far away from the explosion. Can I make it behave differently?
     
  38. fschneider

    fschneider

    Joined:
    May 26, 2014
    Posts:
    42
    Yes, that also happened to me. So I tagged multiple cams as the main cam. No problems till now. Just have to make sure that there is only one of these active at a time, I guess.
     
  39. fschneider

    fschneider

    Joined:
    May 26, 2014
    Posts:
    42
    I have another question: For a given detonator with detonator spray, I would like to set the max size for all its particle emitters at runtime. It seems when instantiating the prefab, the game objects with the particle emitters are not there yet. Any hint regarding that?
     
  40. maxfelker

    maxfelker

    Joined:
    Nov 2, 2011
    Posts:
    10
    Hey Everyone,

    FYI that this does work in Unity 5 - there are just a few scripts that don't work. Specifically, they are the heat wave and shock wave scripts. If those are disabled, there are no issues visually.

    Thought I'd mention it but would rather see a Unity 5 update for this package!
     
  41. SpaceRay

    SpaceRay

    Joined:
    Feb 26, 2014
    Posts:
    355
    Thanks very much for the unity 5 compatibility tip, and I agree that a full unity 5 update would be great, but considering that this is a free asset I do not if it will happen, or at least soon, he offered kindly this great, amazing and powerful asset with beautiful explosions for frèe
     
  42. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    6,555
    I'm updating one of my older games and the plan is to update/optimize Detonator to use the latests particle system as the current system appears to be quite a performance hit in the profiler. Although an official update would be great!
     
  43. DiebeImDunkeln

    DiebeImDunkeln

    Joined:
    Nov 17, 2014
    Posts:
    8
    I really like this detonator, but I have the problem that no particles appear if I build a Mac .app file.
    It works fine on a Mac in the Editor and also fine on a PC in the Editor and in the build .exe file, but not in a Mac .app file build. Any ideas?
     
  44. schmosef

    schmosef

    Joined:
    Mar 6, 2012
    Posts:
    797
    In case anyone has missed it, the "Particles" scene in the free Standard Assets Example project for Unity 5.x is very similar to this asset.
     

    Attached Files:

  45. DiebeImDunkeln

    DiebeImDunkeln

    Joined:
    Nov 17, 2014
    Posts:
    8
    I found a solution for my problem. I had to go to ProjectSettings -> Graphics and add 2 needed particle shaders. Otherwise they can't be found in the Mac .app build.

    Example picture:
     
  46. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    6,555
    Probably best to raise that as a bug as they should be automatically included.
     
  47. DiebeImDunkeln

    DiebeImDunkeln

    Joined:
    Nov 17, 2014
    Posts:
    8
    if I use the test scene in the same project, they will be added automatically. But if I use the test prefabs in my own project they are not added. But only in the Mac build. In the pc build all is running fine.
     
  48. Arowx

    Arowx

    Joined:
    Nov 12, 2009
    Posts:
    6,555
  49. Peecha

    Peecha

    Joined:
    Dec 2, 2013
    Posts:
    11
    Hey @benthroop
    i like your detonator system. But sometimes i encounter crash on ios:

    Code (CSharp):
    1. Can't add component because class 'EllipsoidParticleEmitter' doesn't exist!
    2. UnityEngine.GameObject:AddComponent(String)
    3. DetonatorBurstEmitter:Awake()
    4. UnityEngine.GameObject:AddComponent(String)
    5. DetonatorFireball:BuildFireballA()
    6. DetonatorFireball:Init()
    7. Detonator:UpdateComponents()
    8. Detonator:Start()
    9.  
    10. [ line 38]
    11. (Filename:  Line: 38)
    12.  
    13. NullReferenceException: A null value was found where an object instance was required.
    14.   at DetonatorBurstEmitter.Awake () [0x00000] in <filename unknown>:0
    15.   at UnityEngine.GameObject.AddComponent (System.String className) [0x00000] in <filename unknown>:0
    16.   at DetonatorFireball.BuildFireballA () [0x00000] in <filename unknown>:0
    17.   at DetonatorFireball.Init () [0x00000] in <filename unknown>:0
    18.   at Detonator.UpdateComponents () [0x00000] in <filename unknown>:0
    19.   at Detonator.Start () [0x00000] in <filename unknown>:0
    20. UnityEngine.GameObject:AddComponent(String)
    21. DetonatorFireball:BuildFireballA()
    22. DetonatorFireball:Init()
    23. Detonator:UpdateComponents()
    24. Detonator:Start()
    Using unity3d 4.6.7p2, iOS 8.4
     
    Last edited: Jul 29, 2015
  50. ChrisAntaki

    ChrisAntaki

    Joined:
    Aug 21, 2013
    Posts:
    1
    I'm really impressed with Detonator! At first I thought it was broken in Unity 5. Placing all of its assets into the "Resources" folder fixed everything though.
     
    Last edited: Nov 3, 2015
    Lee7 likes this.