Procedural Destroy in Unity - Lazy Tutorial

Поделиться
HTML-код
  • Опубликовано: 28 сен 2024
  • I fell in love with lazy tutorials by IanHubert. These one minute tutorials show how to do something amazing for people with mid range knowledge. So this is my turn on unity.
    Have fun! Advanced stuff like many requested!
    Lego Series will continue on saturday.
    Script: gist.github.co...
    Inspired by IanHubert: / @ianhubert2
    (give him a sub)
    #ditzelgames #lazytutorial

Комментарии • 135

  • @WeeklyHow
    @WeeklyHow 4 года назад +111

    You lost me when you put back the knife. We needed that.

  • @N19ht96
    @N19ht96 5 лет назад +4

    Are the god sent you to help Unity dev of something? Because after Unreal releasing Chaos you make a simple clean yet advance procedural destruction like this!
    Unity should hire you to do advanced stuff like this!

  • @GameDevNerd
    @GameDevNerd Год назад +2

    Dude, I like the format and presentation. Most Unity content on YT feels like the author is hand-holding or teaching kids, because there will always be a _vastly_ larger number of beginners with something difficult and catering to them gets the most views. So most videos about Unity are essentially un-watchable for a professional developer or you have to run them at 1.5 or 2x playback speed and skip through em, lol. Autoplay landed me here and I began listening and really enjoyed how quick and to the point the video ran, only 1 minute long! :D

  • @joshuafountain
    @joshuafountain 5 лет назад +13

    Awesome guide, the world has been needing something practical like this forever now

  • @numerotinko
    @numerotinko Месяц назад +3

    0:58 That part hits different at 2024 💀

    • @eestaashottentotti2242
      @eestaashottentotti2242 23 дня назад

      Thomas Matthew Crooks: "I watched this one video from the internet..."

  • @bargledargle7941
    @bargledargle7941 9 месяцев назад +1

    This is simply one of the most amazing tutorials I've ever seen. And the information is extrmeely useful, very confusing topic too.

  • @TrollographyStudios
    @TrollographyStudios 5 лет назад +4

    That's crazy I was just watching IanHuberts tutorials. Make more like these, they are great!

  • @micmacha
    @micmacha Год назад +1

    Finally, somebody who bothers to explain how mesh destruction actually works, instead of copping out and pointing me to an asset store. 👍

  • @SunSailor
    @SunSailor 5 лет назад +6

    Nice! Please more of this, although I can imagine, those are pretty hard to produce.

    • @DitzelGames
      @DitzelGames  3 года назад

      Yes, they are. It takes more time to produce less

  • @iamlettuce8315
    @iamlettuce8315 4 года назад +6

    This is absolutely phenomenal, I would love to have a better understanding of how this works. I hope you make a tutorial series for someone with a beginners understanding of unity to explain this aspect of the unity engine. Also is this code free to use?

    • @legohexman2858
      @legohexman2858 3 года назад +1

      I recommend to learn the basics of unity before doing more complex stuff

  • @Chadderbox
    @Chadderbox 4 года назад +1

    Instructions Unclear: Cut monitor in half with knife

  • @abikfundos1174
    @abikfundos1174 2 года назад +1

    Ohhh maaan, i love you! Thanks 🙏

  • @MassimoRough
    @MassimoRough 5 лет назад +1

    Awesome tutorial approach and result!

  • @Uz986
    @Uz986 5 лет назад +1

    Now thats how tutorial should be👍👍👍
    Subcribing to you becuase of these lazy tuts😂.
    Make more like this

  • @Spelborea
    @Spelborea Год назад

    Awesome work man and very greatful for your sharing.

  • @Geckoo1337
    @Geckoo1337 3 года назад

    Impressive tutorial. This solution is amazing - and in less than one minute :)

  • @FAKKER_rap
    @FAKKER_rap Год назад +1

    This is genius, but sadly it very lags with cascades more than 1, and if box keep falling and crumbling each piece it crashes the project 😮😅😢

  • @smbiplob9476
    @smbiplob9476 Год назад +1

    can you please make this video understandable and slow like a teaching tutorial? nothing can be understood with this fast video seems like ads running.

  • @averageengineeer
    @averageengineeer 3 года назад

    The way u say triangle ! Love the french

  • @IntenseMX
    @IntenseMX 3 года назад

    Great vid straight to point in just one min. Subbed

  • @blueawesomedinosaur
    @blueawesomedinosaur 2 года назад +1

    With about 9 to 10 segments set as the variable, it worked quite well as a script for destroying a lamp in my game. The only issue is that many of the shards fall out of the world. Most likely an issue with unity physics or how it handles rigidbodies switching parents.
    Do I have your permission to use a modified version of your script in my game that may or may not be commercially released if I complete it?
    Thank you for this great solution!

    • @Danilo-by1po
      @Danilo-by1po 2 года назад +1

      How did you limit the segments?

    • @blueawesomedinosaur
      @blueawesomedinosaur 2 года назад +2

      @@Danilo-by1po I think in the script there is an int for the amount of segments it splits into

  • @Wertop78
    @Wertop78 3 года назад +1

    hey can I use this in my game?

  • @LeoHsieh
    @LeoHsieh 5 лет назад +3

    Thanks for the tutorial!
    this is cool I once made a similar tool,tool. however it is not applicable to real game application for most cases
    because of the amount of CPU time to run the division and re-assemble and the worst thing is memory fragmentation.
    It is usable for simple mesh and few cuts.

    • @DitzelGames
      @DitzelGames  5 лет назад +2

      The worst thing is the usage of the mesh colliderr. If your game doesn't need that. You're fine

    • @IkikaeruRaimei
      @IkikaeruRaimei 5 лет назад +2

      Why not using a pool specific to destruction? When the cut are too small, just fade them and then change the mesh with no size (the original is stored anyway, don't destroy it xD), then inactive the game object. So you'll use it later, not so much memory problem and even skip that hellful garbage collector! Now for the generation of fragments, you can do it with other threads (not a huge problem if it's just one or two frames later that you see the mesh being really cut) for the mesh fragmentation. Otherwise, you can also use a compute shader to do that but it's only worth it if the mesh is too huge! But the problem when dealing with compute shader, you will need to use AsyncGPUReadback or AsyncGPUReadbackRequest and those are kinda trikky. It's better to just do some multi-threading for that anyway, because of data latency from the GPU.

    • @DerAua
      @DerAua 4 года назад

      @@IkikaeruRaimei That's a great idea, I could use that, thank you!

  • @sebastiantkaczyk3353
    @sebastiantkaczyk3353 5 лет назад +1

    Inspired by Ian? Nice :)

    • @sebastiantkaczyk3353
      @sebastiantkaczyk3353 5 лет назад

      Funny I was thinking about procedural destroy in Unity today, how to make it.

  • @Kentalian
    @Kentalian 3 года назад +1

    Does anyone know why the MeshDestroy script sometimes creates objects with a bounds.extents.magnitude of 0?

  • @Olavr_UA
    @Olavr_UA 6 месяцев назад

    Griffpath be like:

  • @TheLuismix12
    @TheLuismix12 4 года назад +1

    Very good job I love watching your videos. I have a doubt about the game objects are not destroyed and consume enough memory. What I can do?

    • @DitzelGames
      @DitzelGames  4 года назад +3

      Destroy them with a coroutine after a certain amount of time

  • @NerdyTalking
    @NerdyTalking 5 лет назад

    Lol awesome tutorial!
    I can't wait to implement something like that

  • @muhammadqasim848
    @muhammadqasim848 2 года назад

    i am using this when i call the destroy fuc() onTriggerEnter then it will create too much pieces and system is halt ,hang how to control it

  • @Tikodev
    @Tikodev 5 лет назад +1

    MeshDestroy.cs(119,41): error CS1644: Feature `out variable declaration' cannot be used because it is not part of the C# 4.0 language specification
    I get this error. Any ideas?

    • @DitzelGames
      @DitzelGames  5 лет назад +1

      Player Settings > Change to .net 4.0

    • @茨城童子-n1i
      @茨城童子-n1i 5 лет назад +2

      I got the error message,
      error CS1644: Feature `out variable declaration' cannot be used because it is not part of the C# 6.0 language specification
      change the script, it worked
      At the line 119, change "out var enter1" to "out enter1", and in the same method declare "float enter1;"
      do the same thing to "enter2"

  • @SlavicEgg
    @SlavicEgg Год назад

    how can i make an explosion type hole in a mesh

  • @lintonfor4035
    @lintonfor4035 3 года назад +1

    its not a lazy tutorial if we have to write out the code

  • @Pr_Oygen
    @Pr_Oygen 3 года назад +1

    A knife will help me cuz i didnt understand a thing )

  • @kitsune03
    @kitsune03 Год назад

    This is awesome but my computer CPU is literally exploding Unity trying to do that xd

  • @onequy6648
    @onequy6648 4 года назад

    Thank you very much !

  • @TVBUDDHAS
    @TVBUDDHAS 4 года назад

    any way you can upgrade the script so the different parts created when you destroy the mesh are merged to still be 1 mesh? currently it creates seperate meshes on each destroy which creates huge amounts of batches which make it unplayable... :) thx!

  • @LucasDias-yr7vb
    @LucasDias-yr7vb 4 года назад

    Hello, I would like to use my 3D objects, only when I click to cut the object it sinks to the floor and creates an invisible piece, do you know what it can be?

    • @Livingdeadghost
      @Livingdeadghost 4 года назад

      I used a simple Cube and realised the parts were often a lot smaller than I was expecting. If you switch to the Scene view, can you locate the piece by selecting in the heirarcy and clicking F? I also upped the cascade cuts to about 4 for more pieces. Jumped straight to 25 and locked up my Unity xD. Now I have to look through it, understand it and give it a custom plane, not a random one... Thanks very much for the starting point!

    • @pelayofigaredogarcia6515
      @pelayofigaredogarcia6515 4 года назад

      Hey i was just having the same problem, and in my case it wash an issue with the scale of the imported object. Just un check convert units on the import options and adjust the scale by hand.

    • @Clovelt
      @Clovelt 2 года назад +1

      Hey! Found a fix. Probulderize the mesh and it works like magic! Tools -> Probuilder -> Object -> Probulderize

  • @conchalavand
    @conchalavand 3 года назад

    This is really intersting info. Still the code is not very usable to me: after testing it a bit, it freezes Unity in what seems like a memory leak. Still interesting, though, thanks anyway.

  • @ayalayounger2520
    @ayalayounger2520 4 года назад

    you have to name you Script "MeshDestroy" if you want it to work

  • @onezerodev1756
    @onezerodev1756 5 лет назад +1

    Wow

  • @BadBanana
    @BadBanana Год назад

    Fun

  • @softviz
    @softviz 5 лет назад +4

    Do what?!

  • @paulrobinson4932
    @paulrobinson4932 5 лет назад +3

    Hi, any chance you could do a tutorial on spawning enemies with trigger in a 2D game. I am pretty new to game making and have a script that spawns enemies, but, they are invisible!!!! Only know they're there when hit player. I am completely baffled so if you could help I would be eternally grateful. Enjoying your other tutorials, thanks for your efforts :-)

  • @vfxguy4948
    @vfxguy4948 Год назад

    need tutorial plzz how it works

  • @SemenTyurenkov
    @SemenTyurenkov 9 месяцев назад

    Unity freezes forever if this script is on about 10 object and called at the same time.

  • @Atharol
    @Atharol 3 года назад +1

    Lazy Tutorial? this was way, way way to complicated.

  • @diliupg
    @diliupg 9 месяцев назад

    You should have put Nethanyahu and biden at the end instead of trump.

  • @clementeferrer5070
    @clementeferrer5070 4 года назад

    Twiangle

  • @RegenerationOfficial
    @RegenerationOfficial 4 года назад

    wurth ...

  • @narf0339
    @narf0339 5 лет назад

    poor trump.

    • @DitzelGames
      @DitzelGames  5 лет назад

      I'm sorry

    • @narf0339
      @narf0339 5 лет назад +2

      @@DitzelGames no no no, dont get me wrong, he deserved it.

  • @philmassler9954
    @philmassler9954 5 лет назад +150

    After seeing IanHuberts Blender tutrorials, i was wishing somebody would do the same for Unity. Keep them coming!

    • @DitzelGames
      @DitzelGames  5 лет назад +24

      IDK it's not lazy for the creator ...

    • @MarleySkunk
      @MarleySkunk 4 года назад

      Haha i did same move :D

  • @skj1210
    @skj1210 5 лет назад +28

    Need more tutorials about procedural animation ! Thanks for the good work

  • @lvdb2006
    @lvdb2006 3 года назад +3

    It works great with unity objects but with imported models in doesn't work. Can somebody please help?

  • @Shankie1
    @Shankie1 4 года назад +4

    hey man, thanks for this but is this open source? You have not added a license to the code on github

  • @322ss
    @322ss 5 лет назад +4

    Thanks for this, algorithm seems useful ...if you want more inspiration for quick tutorials, here is another author: Royal Skies LLC (Blender tutorials)

  • @youtubewanderer3989
    @youtubewanderer3989 3 года назад +3

    i tested out the script and it worked so well! but i have but one simple issue, how do i get the parts to not use gravity in the script? or to copy the stats of the original object?
    Edit: i figured it out i did this for the gravity and you can just put in what you want the pieces to weigh
    public float mass;
    public Rigidbody rb;
    //underneath public float ExplodeForce = 0;
    //and then you put this part in its own section
    void Start()
    {
    rb = GetComponent();
    rb.mass = mass;
    rb.useGravity = false;
    }

  • @tusharagarwal5306
    @tusharagarwal5306 3 года назад +2

    Unity crashed.

  • @dan.lespect
    @dan.lespect 4 года назад +2

    When I try to use it, I get this error: IndexOutOfRangeException: Index was outside the bounds of the array.
    MeshDestroy.GenerateMesh (MeshDestroy+PartMesh original, UnityEngine.Plane plane, System.Boolean left) (at Assets/Models/MeshDestroy.cs:106)
    MeshDestroy.DestroyMesh () (at Assets/Models/MeshDestroy.cs:63)
    MeshDestroy.Update () (at Assets/Models/MeshDestroy.cs:27)

    • @salmaanmoosa3103
      @salmaanmoosa3103 4 года назад

      did you fix it?

    • @dan.lespect
      @dan.lespect 4 года назад +1

      @@salmaanmoosa3103 Unfortunately no, I ended up cutting my meshes in Blender manually, took me a few hours

    • @studioshitaketakashita7093
      @studioshitaketakashita7093 Год назад

      @@dan.lespect prolly best way to go - or just do destruction animation fbx also in blender. instantiate that exploding body bits anim when Destory.Enemy

  • @gamingpcgamer459
    @gamingpcgamer459 2 года назад +1

    Great tutorial tho sometimes it gets laggy and this is not good since I want it for mayor destruction

  • @JustSomeGameDev
    @JustSomeGameDev Год назад

    Thanks buddy *steals code*
    not really lol

  • @basseloob8763
    @basseloob8763 3 года назад +1

    not working am sad

  • @agrihonoberjorn1612
    @agrihonoberjorn1612 2 года назад +1

    Could this be used to make destructible rock in a mineing game?

  • @KillerGameDev
    @KillerGameDev 3 года назад +1

    Im going to do evil things with this.

  • @jakematchett8160
    @jakematchett8160 2 года назад +1

    The amount of times I've searched this up haha, thanks g

  • @Tyhoot
    @Tyhoot 7 месяцев назад

    So thats code....i legit have to right thay?

  • @tdya1
    @tdya1 3 года назад +1

    That Trump move was funny 😂

  • @phatbeetstudios7811
    @phatbeetstudios7811 3 года назад +1

    This is what I needed, thank you very much! Definitely earned a like and sub

  • @Vertexiver
    @Vertexiver 3 года назад +1

    I have a question abou this script. I used another cutting script called "ezy slice" before and both the old one and yours have the same weird behaviour. It is working on Unity priimitves like cubes and spheres but not on imported objects. even imported cube objects D: any idea why? greetings Oliver

    • @lvdb2006
      @lvdb2006 3 года назад +1

      Have you fixed this?

    • @xyt2826
      @xyt2826 Год назад

      Have you fixed this?🥲

    • @gokcin1943
      @gokcin1943 Год назад

      There is a setting such as read/write in the mesh settings of the imported objects. When you change this setting, the problem will be solved. @@xyt2826

    • @Vertexiver
      @Vertexiver Год назад

      unfortunately not :(@@xyt2826

    • @NeoCortexVT
      @NeoCortexVT 14 дней назад

      For future reference, in the Model tab of the imported fbx, you have to set Read/Write Enabled to True, and then Apply and click Open at the top op the options. That worked for me.

  • @alsgaming1426
    @alsgaming1426 3 года назад +1

    Help how do i make the fragments dissapear after so long

  • @mikaxms
    @mikaxms 5 лет назад +1

    Haha you’re quite funny!

  • @BeeBeeCoding
    @BeeBeeCoding 4 года назад +4

    i think i laughed to hard at trump part lol

  • @clarkrosefx7094
    @clarkrosefx7094 5 лет назад +1

    COOL!

  • @soma_donat
    @soma_donat 3 года назад +1

    This is very awesome. Good job! But I have a question, how can I make the broken parts not break again anymore? I need this for a private game but i can't figure it out. If anyone could help me I would be very thankful

    • @trashcaster
      @trashcaster Год назад +1

      If you are still stuck on this, just add a check for a component (create a "dummy" one that will be used to flag objects), or the object's tag (if you are using the tag for something else, use the component method instead) on the game object before attempting to slice it.

    • @gokcin1943
      @gokcin1943 Год назад +1

      There is a code in the MakegGameObject function where this script is added, you can delete it, but there is a problem that the first object that is cut never remains as it is, and since the rest of that object is created as a new object, you remove this script from the main object and you can follow an orientation accordingly. Of course, it's a little late to say this.

  • @tomatoway
    @tomatoway 2 года назад

    I use this script on my models but it`s not working. When i create models in Unity it`s working. How i can fix that?

  • @constructproofficial4752
    @constructproofficial4752 5 лет назад +1

    awesome work =)

  • @griff7293
    @griff7293 5 лет назад +1

    Brilliant!

  • @zenproduction5584
    @zenproduction5584 4 года назад

    hello can you help me I want to use something like this
    DestroyMesh(MeshFilter meshFilter,MeshDestroy meshDestroy){
    }
    input : DestroyMesh(other.gameObject.GetComponent(), other.gameObject.GetComponent());
    Getting Error of null referance of MeshDestroy at this line........... parts[i].MakeGameobject(meshDestroy);

  • @GameDevGeeks
    @GameDevGeeks 2 года назад

    unity lazy tuts.... LETS GOOOOOOOOOOOOOOOOOOOOO

  • @jiricapek6717
    @jiricapek6717 Год назад

    I tried to add a functions for destroying the gameobject after some time delay, but couldn't get it working. Any tips how to implement pls?

  • @sicemshooters
    @sicemshooters Год назад

    i dont know if you're still active, but how do I set the event to happen on collision with a game object like a rocket? I tried but it won't set off the destruction even if it notices the collision

  • @limageur
    @limageur 3 года назад

    Hi,
    Can I use this code in my game ?
    You didn't leave a mail adress anywhere...
    Regards.

  • @CodeBlues-TimeisGold
    @CodeBlues-TimeisGold 3 года назад

    Thank you so much. good luck

  • @DisorientedDeveloper
    @DisorientedDeveloper 2 года назад

    "destroy something worth destroying" destroys trump...
    I like the way you think

  • @DePistolero
    @DePistolero 5 лет назад

    THANK YOU!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

  • @ravenef5315
    @ravenef5315 2 года назад

    dose this work for vrchat

  • @straightafitness
    @straightafitness 2 года назад

    1 minute!!!!!!!!

  • @HiHi-iu8gf
    @HiHi-iu8gf 2 года назад

    pog

  • @johgranger1304
    @johgranger1304 3 года назад

    lol

  • @adamroko8022
    @adamroko8022 3 года назад

    Hello i am new
    Great job has been done
    Need a hint, slightly changed the condition of destruction (Destroyed when colliding with an object on which a certain tag)
    The problem is that it gets destroyed too much, which is bad for performance, sometimes the computer jams, let alone the phone.And the question is, is it possible to somehow limit the number of parts into which an object can be destroyed, For example, the maximum generation of fragments: 100/50/10? ? ?

    • @adamroko8022
      @adamroko8022 3 года назад

      Or something else for optimization

  • @darmikela
    @darmikela 4 года назад

    holy crap this was awesome

  • @tehuster
    @tehuster 5 лет назад

    *procedural

  • @INeatFreak
    @INeatFreak 5 лет назад

    more

  • @DerAua
    @DerAua 4 года назад

    Hillarious, but also awesome! Thanks man!

  • @ВладиславМухлисов
    @ВладиславМухлисов 3 года назад

    Great tutorial! Thank you!

  • @dan-mechanics2014
    @dan-mechanics2014 4 года назад

    [Physics.PhysX] QuickHullConvexHullLib::findSimplex: Simplex input points appers to be coplanar. Does anyone know what this means?

    • @DitzelGames
      @DitzelGames  4 года назад

      That's a warning. It means that your mesh has no volume in the convex hull. Physics will be inaccurate

    • @dan-mechanics2014
      @dan-mechanics2014 4 года назад

      @@DitzelGames is there a way to avoid this? with a if statement?

  • @knightmake1193
    @knightmake1193 4 года назад +2

    Can you do a more detailed tutorial on this?

  • @BrianBakerCA
    @BrianBakerCA 3 года назад

    The ending couldn’t have been more perfect lol

  • @Sagaan42
    @Sagaan42 3 года назад

    I don't want to ruin the party, but please work on your pronunciation of Rs. As a non-english native myself, it makes it quite hard to understand you when all your Rs feel like Ws.
    Otherwise, good video!