Awesome Easy DESTRUCTION in Unity! (Add SECRETS!)
HTML-код
- Опубликовано: 28 сен 2024
- 🌍 Start planning your next game using Milanote (sign up for free with no time limit!): milanote.com/c...
✅ Get the Project files and Utilities at unitycodemonke...
🌍 Get my Complete Courses! ✅ unitycodemonke...
👍 Learn to make awesome games step-by-step from start to finish.
🎮 Get my Steam Games unitycodemonke...
Sponsored by Milanote
POLYGON Heist - Low Poly 3D Art by Synty cmonkey.co/syn...
🔴 RELATED VIDEOS 🔴
Awesome Third Person Shooter Controller! • Awesome Third Person S...
SLICE objects, CUT doors or BREAK them inside Unity! • SLICE objects, CUT doo...
Ultimate Unity Overview (40+ Tools and Features Explained!) • Ultimate Unity Overvie...
How to make a Health System • How to make a Health S...
What are Interfaces? (C# Basics) • What are Interfaces? (...
💬 Let's learn how to make the simplest destruction possible in Unity.
This is a pretty easy method, you just use the built-in ProBuilder tool to slice a mesh into various pieces.
Then add a Health System to your object, spawn the prefab with the separated parts when the health is depleted and polish it with some VFX and some Physics!
🌍 Get Code Monkey on Steam!
👍 Interactive Tutorials, Complete Games and More!
✅ store.steampow...
If you have any questions post them in the comments and I'll do my best to answer them.
🔔 Subscribe for more Unity Tutorials / @codemonkeyunity
See you next time!
📍 Support on Patreon / unitycodemonkey
🎮 Grab the Game Bundle at unitycodemonke...
📝 Get the Code Monkey Utilities at unitycodemonke...
#unitytutorial #unity #gamedev #madewithunity #unity3d #unity2d #indiegame #gamedevelopment #indiedev
--------------------------------------------------------------------
Hello and Welcome!
I'm your Code Monkey and here you will learn everything about Game Development in Unity using C#.
I've been developing games for several years with 8 published games on Steam and now I'm sharing my knowledge to help you on your own game development journey.
I do Unity Tutorials on just about every topic, Unity Tutorials for Beginners and Unity Tutorials for Advanced users.
You can see my games at www.endlessloopstudios.com
--------------------------------------------------------------------
- Other great Unity channels:
Unity - / unity3d
Brackeys - / brackeys
Dani - / @danidev
Jabrils - / @jabrils
BlackthornProd - / @blackthornprod
Sykoo - / sykootv
Jason Weimann - / @unity3dcollege
Jonas Tyroller - / @jonastyroller
--------------------------------------------------------------------
- Website: unitycodemonke...
- Twitter: / unitycodemonkey
- Steam: store.steampow...
🌍 Start planning your next game using Milanote (sign up for free with no time limit!): milanote.com/codemonkey
✅ Get the Project files and Utilities at unitycodemonkey.com/video.php?v=tPWMZ4Ic7PA
🌍 Get my Complete Courses! ✅ unitycodemonkey.com/courses
👍 Learn to make awesome games step-by-step from start to finish.
🎮 Get my Steam Games unitycodemonkey.com/gamebundle
we need a pickup physics and how to your player to hold weapons video pleaseeeeeeeee :)
first of all it didnt let me use cube as second object, so i probulderized it. Then i moved it there and clicked apply. Unity quit without any explanation. THIS is why it is considered experimental ;-). Unity 2021.3.8f
crashes every single time
even working with 2 simple cubes caused it to crash at second intersection. Will try U 2020 just to do this.
crashes every time also in 2020.3.35f
I’m actually probably going to try Milanote! The first sponsorship that I actually am going to use!
Yup it looks great! I'll definitely be using it in future design-heavy projects
You're started uploading more frequently i'm apriciate that :D
Blender has something called Cell Fracture which is highly customizable and can can create some realistic shatters. Is there something like that in Pro Builder or anywhere in Unity, or is there a way to import it into Unity?
I don't think there's another tool other than the ProBuilder Boolean so no. You could build it yourself by calling the same function ProBuilder uses, or look into an asset called Rayfire, looks really awesome
yes you can import from unity from blender fractures easily
@@CodeMonkeyUnity Ok Thanks. Code Monkeyl, will you do Unity vs Unreal? Please!
@@mehmetkeremceylan9915 So we can import all the the tiny shatters into Unity as on object without a headache?
@CreepyFace
ruclips.net/video/S1UvEd1xkco/видео.html
If you do a Ctrl+R, Ctrl+R on the class name to change it, the file will be renamed too (at least in recent versions of the VS plugin)
Can you do it like by itself ? like when you damage a wall, you run a program, that will generate it according to the localized position of impact ?
what I was looking for, thanks!
While this does work well for things like walls, breaking, for example, glass, will look wrong. Realistic breaking of fragile materials would need more broken pieces near the impact.
But as a starter or entry point I think its very good
You could just slice the mesh up into even finer pieces.
Sure, always use the right tool for the job, you could still use this then maybe dynamically you would break each part into more parts on the impact point
Looking forward for you to creat a tutorial about creating a nft game using unity 👌
Can you pls make a video of how to throw a ball like in the game "smash hit "
Really one of your best videos so far. You connected so much things to create something really fun to do and play ☺️
If you can not see Experimental section: Preferences -> ProBuilder -> Experimental Features Enabled ✓
This was a pretty great video :D it is fun to see the objects being destroyed. I have always wondered how they did these things.
Thanks for another great tutorial. Building all these broken versions of meshes makes me really appreciate UE4's destructible mesh system.
Unity is also having that system but we are using this approach cause it's not quite performant 😀
@@shivamvishwakarma4317 Yeah. UE4's Destructible meshes aren't greatly optimized either. Hadn't actually looked at performance before, but I just did some testing and having destructible meshes in a scene definitely has a frame cost. It's probably best to have a destructible version that you load in at runtime as needed in UE too, so I take back my original statement. It's still nice to not have to edit the mesh though. And UE Destructible Meshes gives some nice physics control and object destruction (removed from scene that is) control with very little work.
Brilliant tutorial
Great video, what if i didnt want all the wall to destroy and rather have a piece destroyed where the bullet impact is, would that be possible?
For that you would need to look into runtime mesh destruction to make it happen only on bullet impact
I haven't tested it but ProBuilder comes with all the source code and you can see what it's doing on ProBuilder/Editor/EditorCore/BooleanEditor.cs and possibly call that during runtime.
@@CodeMonkeyUnity great thanks for the help and keep up the great work!
Hello code monkey can you make a tutorial of making a top down view survival game
I tried this with a Synty character and it left strange artifacts stuck to the cut pieces where I couldn’t follow this procedure to mimic destruction on a character. Any tips or other suggested methods?
You mean there are extra vertices lying around? You can use probuilder to manually move those vertices or just delete them
@@CodeMonkeyUnity Awesome, thanks! I’ll try that! You can’t directly open a Synty Character in Probuilder. It’s because you can’t modify a skin mesh, you have to modify the classical mesh. Then once you’re done and you group the character back together (in your multiple pieces) you have to then export to miximo (or blender) to add the bones back. Unless there’s some easier way. I learned all this from this video: ruclips.net/video/wKPCm4BfgwI/видео.html
Basically I’m trying to create a character that can be cut up or blown up, etc. Falling to pieces might be more interesting than it turning into a ragdoll. Also, perhaps you could have an enemy with his arm cut off still fighting, etc. BTW, I love you’re videos and courses. Thanks so much CM!
How would this be used if wanting AI to walk through once the wall has been destroyed. Navmesh/destructible obstacle.
Hi, can you think stardew valley like game tutorial on youtube or udemy?
You can start by looking into a simple character controller ruclips.net/video/Bf_5qIt9Gr8/видео.html
Then maybe learn how to handle interactions with doors/buttons/NPCs ruclips.net/video/BJ4bNFPuDWA/видео.html
Hi,
When i proBuilderize my GameObject, it become black.
Hey,
I am going to make a 3rd person shooter and I really liked the way you handle shooting, the sound is very nice and the ray casting method with a nice visual is very cool. I would like to do all of that in my game? How?
Watch the third person shooter video ruclips.net/video/FbM4CkqtOuA/видео.html
How can I make the same vertex the pivot on the broken object?
You can use ProBuilder in vertex mode, select the vertex you want and set it as the pivot
@@CodeMonkeyUnity What if normal object has pivot somewhere else than on vertex? Should I change the pivot point of normal object as well?
thank you
Where come your shoot audio ?
I tried the probuilder thing but my model turns completely black, already disabled auto mapping of UV but it still happens.
Did you resolve this ?
Congrats for 314k sub
Unitis particle system goes brrrrrrrrrrrrrr
By dani
ok
idk why? but its invisible!...how to solve that?
It's an issue with the Mesh pivot, go into Vertex mode and make a vertex the Pivot, or select the object and click twice on "Center Pivot"
In milanotw they will help also.
Good day! can you please do a lesson on the enemy?
I made a simple enemy AI here ruclips.net/video/db0KWYaWfeM/видео.html
Cool.
why some project are dead from yours site you cant download
failed to download file on many yours project
Which ones?
@@CodeMonkeyUnity this one
2000 IQ pro monke, * gives banana *
i keep getting this error when it try to apply the boolean
ArgumentNullException: Value cannot be null.
Parameter name: key
System.Collections.Generic.Dictionary`2[TKey,TValue].FindEntry (TKey key) (at :0)
System.Collections.Generic.Dictionary`2[TKey,TValue].TryGetValue (TKey key, TValue& value) (at :0)
UnityEngine.ProBuilder.Csg.Model..ctor (System.Collections.Generic.List`1[T] polygons) (at Library/PackageCache/com.unity.probuilder@5.0.6/External/CSG/Classes/Model.cs:84)
UnityEngine.ProBuilder.Csg.CSG.Intersect (UnityEngine.GameObject lhs, UnityEngine.GameObject rhs) (at Library/PackageCache/com.unity.probuilder@5.0.6/External/CSG/CSG.cs:122)
UnityEditor.ProBuilder.BooleanEditor.MenuBooleanOperation (UnityEditor.ProBuilder.BooleanEditor+BooleanOperation operation, UnityEngine.ProBuilder.ProBuilderMesh lhs, UnityEngine.ProBuilder.ProBuilderMesh rhs) (at Library/PackageCache/com.unity.probuilder@5.0.6/Editor/EditorCore/BooleanEditor.cs:342)
UnityEditor.ProBuilder.BooleanEditor.MenuIntersect (UnityEngine.ProBuilder.ProBuilderMesh lhs, UnityEngine.ProBuilder.ProBuilderMesh rhs) (at Library/PackageCache/com.unity.probuilder@5.0.6/Editor/EditorCore/BooleanEditor.cs:380)
UnityEditor.ProBuilder.BooleanEditor.OnGUI () (at Library/PackageCache/com.unity.probuilder@5.0.6/Editor/EditorCore/BooleanEditor.cs:168)
UnityEditor.HostView.OldOnGUI () (at :0)
UnityEngine.UIElements.IMGUIContainer.DoOnGUI (UnityEngine.Event evt, UnityEngine.Matrix4x4 parentTransform, UnityEngine.Rect clippingRect, System.Boolean isComputingLayout, UnityEngine.Rect layoutSize, System.Action onGUIHandler, System.Boolean canAffectFocus) (at :0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at :0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at :0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at :0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at :0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at :0)
UnityEngine.UIElements.IMGUIContainer.HandleEvent (UnityEngine.UIElements.EventBase evt) (at :0)
UnityEngine.UIElements.CallbackEventHandler.HandleEventAtTargetPhase (UnityEngine.UIElements.EventBase evt) (at :0)
UnityEngine.UIElements.MouseCaptureDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at :0)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at :0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at :0)
UnityEngine.UIElements.EventDispatcher.ProcessEventQueue () (at :0)
UnityEngine.UIElements.EventDispatcher.OpenGate () (at :0)
UnityEngine.UIElements.EventDispatcherGate.Dispose () (at :0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at :0)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at :0)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at :0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at :0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at :0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at :0)
UnityEngine.UIElements.UIEventRegistration+c.b__1_2 (System.Int32 i, System.IntPtr ptr) (at :0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at :0)
Looks like you're accessing a Dictionary and passing in null as the key, use Debug.Log to find what is null unitycodemonkey.com/video.php?v=5irv30-bTJw
Boom boom boom 😂
i love how unity just crashes everythime i do it
the downloaded project files is very different for the 1st video you did not even use the starterassetsinput it uses thirdpersoninput. i tot the whole video is to use the starter assets and expand on it its almost like you dont really want to show us how ez it is i have been stuck in this same spot for almost 2 week my will and mental start is down i just want to quit there is nothing free again in this world like its soo simple i know is soo simple but i cant figure it how and you project files dont help it never works you videos are not full tutorials i see it now your channel is not for teaching its for advertisements
It sounds like you're expecting a free video tutorial to be like a 20 hour step by step course, obviously that's not possible.
This is a learning video, it requires effort on your part to learn, I cannot do the learning for you. If you need a step by step guide then check out a complete step by step course, then when you're more capable you can follow more advanced separate tutorials.
Blender has a way to slice models I think, so maybe one could substitute that for pro builder
#rayfire asset on unity assetstore.
can you share how i could use blender to slice models?
I might drop a tutorial on my channel in the future on this, but here is a text based tutorial (in case if i were lazy) how i do it in blender:
- Duplicate your mesh as many times as many pieces you want it to fall apart. (Ctrl + D in object selection mode then right click so the duplica will sit exactly in the same place and rotation as the original)
-Hide everything in the scene collection panel
-Unhide your first piece, select it and go edit mode
-Press T for the toolbar
-Select knife tool, press and hold it so you can select bisect
-Go into a front or side view with the top right gizmos or press 1 or 3 on numerial pads
-Slice your object, at the bottom left windows now a little window appears called 'bisect'
-Click clear inner or outer (i usually go with inner but depends on the cut position) then click fill. (this will make a single piece out from the original)
-Repeat the cutting in all other pieces expect your original object
-When you have the original object + the pieces ready select your original object in object mode
-At right side click the little wrench (modifiers), then add modifiers dropdown and select boolean
-Inside the boolean modifier click on the "object" and choose one of your pieces
-Then choose the little arrow near the where you can delete the modifier and click apply.
Tadaa! You have your pieces and original object (which should turn into a piece if you make a lot of cuts) and they all perfectly fit so you dont need to puzzle them together. Export and it into fbx and have fun in Unity with destroying your original prefab and instantiating your broken prefab.
if you dont have the experimental menu make sure you have probuilders experimental mode on in preferences
Thanks
Are you trying to teach us how to make battlefield
You can definitely try!
to make the entire breakable wall script 1000 times more simple just do this:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class BreakableWall : MonoBehaviour
{
public float health = 50f;
public GameObject destroyedVersion; // Reference to the shattered version of the object
public void TakeDamage(float amount)
{
health -= amount;
if (health
Unless you only have a single object in your entire game that uses the concept of health, you should probably have a dedicated HealthSystem
Also you should not make variables public unitycodemonkey.com/video.php?v=pD27YuJG3L8
@@CodeMonkeyUnity That is true, i was just trying to come up with an easier solution
Very nice! I really like how you are building bigger projects on the smaller tutorials you have made in the past. I like to take the smaller code tutorials and make packages out of them. It makes it easy to toss them into new projects!
What about the edge of the broken pieces? The method used in this video doesn't apply any texture to them, so they are transparent. Is there a simple way to add some texture to the edges of all the broken pieces?
It applies the texture from the second object, in this case when I cut it I used a transparent material for the cube to see through it so that's what the final object uses, you can easily swap that for a fully opaque material or anything you want.
I only noticed that after I recorded the video, you can see the Crate doesn't have that issue, the cut parts are opaque.
Bro will you continue this series and please teach us how to add enemies or make it multiplayer and stuff like that!! Please!
CAN ANYONE RECOMMEND ME A C# IDE EXCEPT VS Code.....
I use Visual Studio, the Community version is free
@@CodeMonkeyUnity oh thanks for the Information :)
Your tutorials are amazing please make tutorial on how to do hacking and lockpicking minigame
blender users, just searce blender Cell Fracture, it takes 20 sec to make any complex breaking model
Maybe also make a tutorial for the blender cell fracture addon it is much more easier
We can use the cell fracture addon in blender to easily create the broken parts of wall in seconds without any effort.
Sure, that also works
duplicating 3d objects and it is not an efficient solution, I recommend building the game on types of destroyed objects ... example: small objects are removed and replaced with a destruction effect with a few small leftovers of 3D objects, large objects cannot be destroyed it can add a striking effect to their texture and so on ... but it's funny
As always you have to choose the right tool for the job. If your plan is to build something like Control where you have a massive amount of destructible debris flying around then yes use a different, more performant approach.
Plz make more videos on it
Was this video reuploaded?
I covered the Boolean Tool in a separate video, here I combine it with shooting and a health system to make some simple destruction
Great tutorial.
Is there a way to create a system to dynamically create pieces? So you get different pieces each time the object is destroyed?
Probably using code to generate new geometric 3d models and then editing the texture (by code too).
If i recall well, unity does have polygon edit by code.
One simple way to fake it would be to create several different prefabs, each cut a different way. Make enough of them and the player probably won't notice.
The complex approach would be to run the slicing logic at runtime.
The easy approach would be to make a bunch of variations of the destroyed object, then spawn each variation at random
Im hving problm with the OnDead EventHandler, I've followed the Health tutorial but its not there...Great video btw
What problem? It's a simple event that should be triggered when the health goes under 0
Sir make a video on how to make keypress play a particular animation,
And pls make a series like brackeys where he makes a complete game for beginners it has 11 videos.
For that you really just need a condition on the Animator and set the animator parameter on a key press.
If you're looking for a complete step-by-step path check out my complete courses ruclips.net/video/PcArjIC1QnQ/видео.html
@@CodeMonkeyUnity yes sir and please make a Beginners tutorial like brackeys,this will help me a lot in making animations,Thank you sir.
I tried using Milanote for a little while but it makes my projects seem way bigger than they will ever really get lol
Use blender to cell fracture, it can be done in a few clicks, using pro building isn't how you'd normally do this
nice video as usual. i will really appreciate if u explain how to make walls like rainbow six siege game to be destroyed partially with explosive or making whole where we shoot at it
Hey, i'm having a problem where if anything touches the destroyed parts of the wall, the parts turn into kind a flat or 2d version of themselves, but the colliders will stay in tact. Any ideas why?
Edit: I've found the problem. It was caused because I had given the game object the wall pieces would be inside, the same component values as the undestroyed wall. So when the script spawned the object the empty got distorted, causing the wall shards to be distorted too.
How do i make a screen shatter effect?
Like shatter the image the camera sees? Well you could combine this exact effect, apply it to a quad mesh, and use a RenderTexture with the last image the camera sees
I covered RenderTextures here ruclips.net/video/Ah2862Gz3_s/видео.html
Interesting idea!
@@CodeMonkeyUnity Thanks for responding! Im making a turn based RPG so I'm trying to make a cool battle transition
That pro-buider tip... priceless. So much better than what I used to do. Copy/paste, thank you.
Fast and good as always
Awesome thanks!
Nice, thanks
Amazing!
Do you happen to have a tutorial about this but insted of global destruction of the object, to make it focalized destruction?
For that you need a different more dynamic method, perhaps using Rayfire unitycodemonkey.com/video.php?v=Hd7yBrm2vnc
I recall there is a package selling on asset store that will do the cut automatically.
Yup there's Rayfire, looks really awesome but I haven't used it yet
What did you do to make your slices look so good? Whatever I try it just looks blocky and bad. I don't want to have to add blender to my development pipeline if I can slice object easily in Unity, so please lmk. Maybe it just comes with practice, and if so i'm fine with that.
Not sure what you mean by "good", just make the slices appear random instead of neat squares and slice as much as possible instead of keeping giant gaps
@@CodeMonkeyUnity I was just wondering if you sliced the wall by hand, just worded it wrong.
Nice way can you have an option of creating a new mesh colider were every bullet hits so you can cut the mesh with fire for example?
I haven't tried it but this tool should work in realtime so you could to that
@@CodeMonkeyUnity maybe a stencil of impact on every bullet will define the mesh target or use the boolian way like you showed but instead of a cube it's the bullet in real time
Hello sir i published your flappy bird game from your flappy bird video and it got suspended from play store
Please help me
You can't call it Flappy Bird, someone already owns that name
Not even flying aves worked
@@CodeMonkeyUnity my game is suspended can i do something about it