The way he explains is so perfect, this is the process of thinking and how everyone should learn programming and I would recommend Craig to everyone to watch!
@darketomaly2 жыл бұрын
If you're wondering how to save the mesh, just place this at the end of the code. AssetDatabase.CreateAsset(finalMesh, $"Assets/{name}-{GUID.Generate()}.mesh"); AssetDatabase.SaveAssets();
@greatstaro92554 жыл бұрын
You are the first one explaining this on the internet, thank you!
@VectorIV7 жыл бұрын
"Delete all the children."
@theairaccumulator71446 жыл бұрын
Lol
@soaringsquid0.1294 жыл бұрын
Hide ya kids, cuz he gonna fetus deletus RIP both memes from this comment Cause of death: Time
@blueIgle3 жыл бұрын
Master Skywalker, there are too many of them, what are we going to do? delete all the children
@DarkDax5 жыл бұрын
Just binge watched some of your videos and I have to say they’re incredible. Well paced, well explained, and not too serious. Love it, keep it up!
@GodslayerXUL4 жыл бұрын
Such a good tutorial. You seem like a really nice guy and make those videos very pleasant to watch. This also solved my problem, as I noticed my performance dropped significantly once I finished my level. I first suspected my scripts, but it was actually the physics system being overwhelmed by 3000+ meshes (spikes in a platformerr) with mesh colliders. After combining just a few big chunks my CPU times dropped from 23ms to 11ms. Thank you!
@RaebEeffoc2 жыл бұрын
This was exactly what I was looking for. Managed to gain a decent amount of FPS with this! Thank you very much
@SillyFennecsForeverАй бұрын
Such a nice tutorial. It is really well made
@rodgermccallister16064 жыл бұрын
Fantastic tutorial! After watching three other tutorials, this is the first one that made me actually understand what was happening. Your method of teaching is amazing, subscribing now!
@UserRandomized4 жыл бұрын
Awesome tutorial!! Those who truly wish to learn new techniques understand that it takes time. I noticed you mentioned the video being 20 minutes was an issue, but it isn't an issue at all. It was a very informative video and I learned a lot from it.
@civil15 жыл бұрын
ahhhh "Do the rotation first, because rotation might change the position" You just solved my problem, thankyou! (The rotation of the combined mesh was occasionally subtly wrong)
@AesnasSticks4 жыл бұрын
0:25 "It'd be a total *mesh*" Get it? :D
@shadowyt60384 жыл бұрын
okie............ xD
@aryanbaburajan3 жыл бұрын
@@shadowyt6038 Holy Cow its ridiculously stupid and crazy how I managed to find a comment of my old account lmao I don't even remember watching the tutorial!!
@fafase8 жыл бұрын
This is a video of the Mesh.CombineMesh script from Unity docs. And in the same way, it does not consider going over the limit vertex amount (65k). You should be keeping track of the vertex count and create a new object when reaching the limit.
@rikkcarey8 жыл бұрын
Awesome tutorial! Enjoyed your sense of discovery and beginner's mind!
@myrzagali.alikhan2 жыл бұрын
Thanks, you solved my problem with positon. Well explained! :D
@DePistolero6 жыл бұрын
I felt like at home man... like listening to my brain go about things, only you knew exactly what were you doing :) My brain usually doesn't :) So I spend a couple of hours on YT and videos like this one.... THANK YOU :) :) :)
@EXHOUL4 жыл бұрын
If anyone is getting a different size mesh as a result, you can also store the original scale too. Make sure you update it before the position and rotation :)
@shihmeng918 жыл бұрын
this is a great tutorial, just wish that you could complete it, as for the issues for different shared or texture is use.
@CraigPerko8 жыл бұрын
I figured most of my viewers wouldn't need that, but it's not too complex. If you need a lot of functionality, I recommend downloading something from the asset store - there's a lot of mesh combiner libraries available.
@simbioscope30764 жыл бұрын
I know this is a bit old but it has really helped me to understand what the heck was going on, I wasnt able to do it with my model and dunno why its not working maybe because of the model, I will test it with a simple one to see if it´s because of the model. Thank you for this video.
@inframatic8 жыл бұрын
At first I thought "Why does this video exist since Unity has had a CombineMeshes method since 2011. Then I realized that the CombineMeshes doesnt work at all and especially if the object is so big that it has many submeshes
@ewwitsantonio6 жыл бұрын
Really enjoy your teaching method!! Great stuff. Very easy to follow your train of thought and method. :)
@ThatOneXander8 жыл бұрын
I never knew i needed to know this until i watched your video. Thank you and keep up the videos, Subscribed
@RealToOy5 жыл бұрын
Great tutorial! Couple of questions though.. -How can I keep the materials programmatically? I noticed you did it with drug and drop. -What happens if the children have different materials? In other words, how do I keep the same texturing programmatically so i dont have the purple oject but the exact original one? Obviously if the object has one material we can apply like: Material theMaterial= Resources.Load("theMaterialName", typeof(Material)) as Material; GetComponent().material = theMaterial; But what if it has multiple materials? Thanks!!
@joeysipos2 жыл бұрын
This was an awesome tutorial! Thank you so much! Exactly what I needed!
@CraigPerko2 жыл бұрын
It's getting pretty old, I think some of the details have changed. I don't use Unity any more, so I couldn't say for sure.
@joeysipos2 жыл бұрын
@@CraigPerko worked perfectly in Unity 2020!
@joeysipos2 жыл бұрын
@@CraigPerko why did you stop using Unity?
@CraigPerko2 жыл бұрын
@@joeysipos The company that owns it is incompetent. They're desperately chasing Unreal instead of aiming to provide a decent engine, and that will never work because Epic has literally 1000x more money. It's destroying the engine.
@joeysipos2 жыл бұрын
@@CraigPerko I don’t know if that true though. I looked it up and Unity owns like 65% of video game market share vs 13% for unreal. For AAA games it’s a great engine. But Indie dev like myself I am in love with Unity! Both have pros and cons.
@LuRybz7 жыл бұрын
Man, you are in another level. Seriously, congratulations. Where did you learn all of this (Games in general)? I am really interested in this Editor, for a huge personal project. This is pure modularity, awesome.
@HaikelTV7 жыл бұрын
this is Mesh.CombineMesh from unity docs ... he didn't do anything other than copying the code from unity docs docs.unity3d.com/ScriptReference/Mesh.CombineMeshes.html
@erfanzandi1362 Жыл бұрын
wow great video
@danielstoy1715 жыл бұрын
Thanks for this tutorial! Really helped out with optimizing my scene
@ozanyokuva69304 жыл бұрын
I have 2 things to say , but first I must say , you gave me a perspective. First thing , now my scene file is 300MB... and outpur APK is 100MB which is caused by massive header files. You should also show how to make these meshes a prefab dude. Second is , it is better to search the scene and get the mesh from a same object of your object instead of recreating it . You dont need to create the same mesh if you already created it with a clone of your object. doing this lowered my scene file size but I still have the file headers size problem although I am using the same mesh for same type of objects :/
@LasseloH8 жыл бұрын
Thank you so much for this, this tutorial is gold
@sadoqdraws11703 жыл бұрын
Thanks to Allah for sending you to explain all these stuff and thank you men for all the effort you put out there!
@bogdan11156 жыл бұрын
Great step by step explanation! And furthermore, your voice is funny :D
@gregoryosborne63464 жыл бұрын
Phew, thank you so much. Very clear.
@StillNight776 жыл бұрын
This was amazingly helpful, thank you.
@zedgamedev6 жыл бұрын
Thanks Bro!! Works exactly the way it should.
@kaneaustin87084 жыл бұрын
combine mesh instance 0 is null... can't find a solution to my problem anywhere.
@CraigPerko4 жыл бұрын
You probably didn't initialize your combine mesh instances properly.
@malcolmhollett86387 жыл бұрын
Very great video, huge help, thanks.
@jameslavery29588 жыл бұрын
Wow! That was awesome. Thank you very much.
@AkkiAdachi5 жыл бұрын
why dont you have a simeple copy paste in the discription
@jakemarcus99992 жыл бұрын
MeshCombiner editor doesn't find the MeshCombiner script for some reason. I don't find a reason why.
@GudJuJuTV7 жыл бұрын
So from an optimization standpoint, does this reduce the amount of faces that need to be rendered? i.e. removing redundant pieces that can't be seen
@CraigPerko7 жыл бұрын
No. It just manually optimizes how many objects are in the scene, and may reduce the number of draw calls.
@wurty6 жыл бұрын
What about shadow casters?
@jeromej.87266 жыл бұрын
Maybe someone already said it but that'd be cool to have the source code available online :) (even if it's only a few lines of code. I'm coming back to this vid and I gotta rewatch it to get the code back instead of clicking some link in the description :P)
@elizaknight69807 жыл бұрын
amazing, thanks so much :) I will try this for my game
@johnchapman58586 жыл бұрын
fantastic tutorial thank you!
@mzijewel6 жыл бұрын
Thank You very much for your effective tutorial.
@SimantoRahman6 жыл бұрын
Hey amazing tutorial. Is there any way to do this without using the CombineInstance class? I wanted to know if there are any hands-on way to do combining of vertices, triangles, uv maps and what not. I'm under the impression that will be faster...
@CraigPerko6 жыл бұрын
It won't be faster, but yes, you can. The problem is the vast number of possible things you'll need to combine - submeshes, verts, uvs, colors, uv2s, bone mounting, etc.
@sallerc7 жыл бұрын
Interesting, but you should really increase the fontsize (or lowering the resolution) when recording.
@Zil673 жыл бұрын
I keep getting the error "The namespace '' already contains a definition for 'MeshCombiner'" What do I do?
@SpicyMelonYT3 жыл бұрын
Its been 4 months so I doubt you still have this problem but I would assume that the error is telling you that unity now has a MeshCombiner Class. So maybe you can use it to do what this video shows off but if not then just name it something else. Like MyMeshCombiner or MeshesCombiner
@lazyemperor51823 жыл бұрын
Its 2021, So Do we Have a shortcut way IN Unity 2019 or above for oneclick Mesh Combining Or Somethin
@Arniox6 жыл бұрын
How would you carry over textures into final mesh? I want to do this for a bunch of trees to make them lighter weight and the textures break it so hard.
@CraigPerko6 жыл бұрын
If they're the same tree over and over, use GPU instancing instead. If there's only a few hundred of them, set them to static and let Unity handle it. But if you still need to do this, there's no reason the "textures" can't carry over. Just assign the same material to the new meshrenderer.
@julorapido2 жыл бұрын
BELLISSIMO
@jarinusgermeraad63287 жыл бұрын
Hello there! First of all, thanks for this video, it has taught me a bunch of stuff and has inspired me as a newb Unity user! I got the mesh combining to work perfectly fine (using Matrix4v4.identity instead of doing anything to my parent transform), but I need the meshes to be split. The reason for that is that I'm combining tile meshes into one mesh, but those tiles are not necessarily connected, so they're effectively tiles on separate planes. What I would like to be able to do is apply textures per plane, thus I would need the mesh to be subdivided into those planes or accessible per plane. Could you give me some tips on the smartest way to do this? You can also message me if you have any questions about my situation, as I'm using it for a grand procedurally generated environment.
@CraigPerko7 жыл бұрын
In general, you can usually get away with using submeshes: answers.unity3d.com/questions/312492/submesh-creation-from-script.html Each submesh is its own material.
@jarinusgermeraad63287 жыл бұрын
Alright, thank you!
@yetojesse7 жыл бұрын
Hey. hope I'm not too late for a reply. I made a mesh out of a small obstacle course I made. (stairs up, fall through hole, walk a few steps, done). Problem is, it falls through the terrain when I try testing it. Adding a box collider to the parent helps against falling, but of course makes it impossible to enter.
@CraigPerko7 жыл бұрын
Meshes and colliders are different things. You'll need to figure out how you want to do colliders, but in general, you don't want to have one giant mesh collider.
@rafaelcorrea79598 жыл бұрын
Craig, Quick question. is it worth to combine meshes of things that have a "short life"? I'm making a civilization game, and I'm wondering if the visual feedback from selecting tiles would be worth to combine into a single mesh.
@CraigPerko8 жыл бұрын
+Rafael Corrêa Probably not? The cost of combining is really high.
@RoseWoodKitty5 жыл бұрын
I know this video is kinda old but im running into an issue where its not doign all of the meshes that need to be combined, its gtting a bit over a quarter of them before giving up, there arent any errors showign up and its just being kidn of weird, Theres also alot of tris being randomy created. any idea as to what maybe happening?
@ming454 Жыл бұрын
I have an error CS0029: Cannot implicitly convert type 'UnityEngine.MeshFilter' to 'UnityEngine.MeshFilter[]'...
@CraigPerko Жыл бұрын
You're passing it an object and it wants an array of objects.
@JiosX4 жыл бұрын
Hello. I know I'm a bit late but what if I want to put like 500 cubes and combine them together using this code BUT when one of it is hit by an explosion, only the hit one will be removed? Is that possible?
@CraigPerko4 жыл бұрын
Look into voxel rendering.
@EZboyrocks5 жыл бұрын
Thanks so much!
@DriitzzCabal7 жыл бұрын
question can you do the same for BoxCollider2D ? you see , I spawn my GameObject based on a picture that find pixels color and apply different gameobject to them , then i give them a boxcollider2d for the floor , platform etc . but the issue now is since they are individual boxcolliders they have "bumps" into them when i move around and also " 455 " boxcolliders ... instead of " ~ 12 if they were merged ".
@CraigPerko7 жыл бұрын
Not as "BOX" colliders. Those have to be boxes. You could use a 2D mesh collider, though. Not sure if there's an included way to create a mesh based on boxes: if you have to do it yourself it gets pretty mathy.
@cloud994567 жыл бұрын
Great tutorial! I'm running into one problem though. I have clusters of "rock" meshes set up in 3 locations on my map. Pretend the 3 locations are like the 3 vertices of a triangle. When I run your scripts and the new "combined mesh" is created, a weird mesh line is created connecting the 3 clusters of rocks I have located at the 3 vertices of the imaginary triangle. I hope I was able to explain the issue. Any idea on how to fix this?
@CraigPerko7 жыл бұрын
My guess is that you aren't using this technique, because that sounds like triangle drift. That should only happen when you are doing it manually and forgetting to offset the triangle indexes.
@bitxo86205 жыл бұрын
Should i use it for Marching Cubes Algorithm?
@CraigPerko5 жыл бұрын
In general, you should be building the mesh vert by vert for the marching cubes algorithm. This is a very specific method of combining meshes that's rarely useful.
@vladsamonin97946 жыл бұрын
Thank you for the tutorial. So how we can set a color to the Combine Instance Material?
@CraigPerko6 жыл бұрын
You can either set up a material with the right color and then assign it, or use a MaterialPropertyBlock.
@vladsamonin97946 жыл бұрын
Thank you for the fast reply. The way I plan to use it is in runtime (MonoBehavior) mode. There are hundredth of objects created and each of them contain a different colour. I can get the color by doing filters[i].GetComponent().material.color But I have no idea how to assign the corresponding color into the main mesh. All I have is a pink mesh. I guess I can apply one color to it. But that's now what I would like to do. Here's screenshots: 1) What I have after applying the MeshCombiner. prntscr.com/jz9e27 2) The goal to have this (Currently each cube is it's own gameobject): prntscr.com/jz9dr3 Is there any other advices? I tried to use MaterialPropertyBlock, didn't work for me.
@CraigPerko6 жыл бұрын
My guess is that the MeshRenderer you're putting your mesh into doesn't have enough materials in it. You only get the flat purple color when the MeshRenderer doesn't have any materials.
@CraigPerko6 жыл бұрын
However, that said, you can't assign one material to all the cubes and have it look like that, not unless you're doing vertex color trickery. In general, that sort of look is done either by UV mapping, vertex color, or a shader with a global Z axis color gradient.
@vladsamonin97946 жыл бұрын
Yeah, you right. So I added the material into MeshRender. However still can't assign the corresponding colour to the cube object. I tried to use the vertex colour code but it just creates a gradient. Code: prntscr.com/jzap16 Output: prntscr.com/jzap80 Desired Output: prntscr.com/jzapgm UV map wouldn't work since I don't know the colors of cubes before they generated. It's representation of data generated randomly. Is there's anyway somehow to add all these colors when we generate the final mesh? Or in worst case scenario access the final mesh and add to each of the cubes the appropriate color?
@MegaNerevar8 жыл бұрын
Please provide a way to make a circular hole in a mesh, either on the outline or anypart of the mesh..
@CraigPerko8 жыл бұрын
It's not easy at all.
@MegaNerevar8 жыл бұрын
will it be possible with a vector graphics toolkit ? like SVG importer or Vector Shapes from the asset store ? I want to generate procedurally generated terrain (2D) that is also destructible by projectiles..
@CraigPerko8 жыл бұрын
Well, 2D terrain isn't so hard, just paint some alpha=0 pixels wherever you need to see through it. Collision detection against it requires checking the pixels, though.
@marcrem7 жыл бұрын
Can I use this to then save the combined mesh as a prefab as I would normally do in the editor? I would then instantiate / re-use the combined mesh in my scene.
@CraigPerko7 жыл бұрын
You can, but it requires some finagling.
@justloveandpeace40106 жыл бұрын
Thanks man you are the best
@JJE9904 жыл бұрын
Good tutorial but I noticed something. I have a C++ background. When incrementing or decrementing a value in a for loop, it is better to use PREFIX operators rather than POSTFIX operators, e.g. ++i (prefix, slight performance benefit and safer) i++ (postfix, slower and not as safe) I'm not going to go into detail as to why, the internet has the answers, but it's better to use prefix and to get into that habit. Btw it's not a criticism, it's something not a lot of people know about. There are certain times where postfix is needed and better but usually that's not the case
@bibib85835 жыл бұрын
one question, when the new mesh is turned into a prefab, the mesh filter shows none in the inspector? is that supposed to happen?
@CraigPerko5 жыл бұрын
Combining meshes don't automatically save the created mesh to assets, although it won't mysteriously vanish unless you create it in play mode and then hit stop. Saving assets is another topic, and not too hard of one, feel free to search on that topic for those instructions.
@aleksadjordjic16317 жыл бұрын
Just one question before i try to do this. Will it increase the performance of my game, i currently have a city with over 1000 objects (probably more) and my FPS is 25-30 . Will this help optimizing the game by doing this ??? Thank you :)
@CraigPerko7 жыл бұрын
If it's the same meshes over and over, use GPU instancing or static batching instead. You can find a GPU instancing tutorial on my channel.
@aleksadjordjic16317 жыл бұрын
Ok , thank you , i was wondering what was that option "GPU Instancing" , also do you know if it is possible to convert Unity .prefab in to a 3D file , like .fbx or .blend ??? Thank you , and WOW you responded really fast to this comment :D
@CraigPerko7 жыл бұрын
Perhaps, I've never tried. Normally a prefab is not a mesh, but a bunch of monobehaviours that refer to a mesh.
@Levente205 жыл бұрын
i have a big cad file imported in my scene, i got a tire with tiresidwall together as one mesh, but in the 3ds max its seperate element. In unity its combined as one mesh, how can i detach the sidewall from the tire?
@CraigPerko5 жыл бұрын
Ideally you should re-export it as a separate object. Doing it in Unity is a pain in the ass and involves manually walking every face.
@visanmadalina24826 жыл бұрын
Hi! I am working on a tile based game. I need to combine multiple tiles into one chunk (single mesh). Will i be able to work with the tiles after that ?
@CraigPerko6 жыл бұрын
That's a complicated question. You can technically edit the UVs of the verts, but I don't think you want to... so, "no, not easily".
@havyn886 жыл бұрын
@Craig Perko Thanks for the answer, i got the code working but it didn't fit my project. Do you have any advice on batching materials of large quantities of Objects? I'm trying to spawn 20,000 cubes, and the objects must be interactable with the player. I tried GPU instancing, but the player character simply passed through the items without affecting it.
@CraigPerko6 жыл бұрын
You're talking about voxel techniques. That's a complicated field.
@havyn886 жыл бұрын
I was specifically told to use batching of materials, but the objects are not stuck together, and the batches is like 33k.
@CraigPerko6 жыл бұрын
I think you might be using some unusual terms. There are a few things you could mean. The materials are not per-object. One material can be referenced by thousands of objects. Static objects will batch automatically, or you can turn on instancing to really batch them... but that won't help you to create colliders.
@havyn886 жыл бұрын
the setup creates clones of one of the objects, and all objects have the same mat x20000. I tried toggling instancing but fps actually got worse.
@NeonTheCoder8 жыл бұрын
My childs have multiple materials assigned and anything besides the main material is not saved to the combined mesh so I end up having holes in the mesh for no reason.
@NeonTheCoder8 жыл бұрын
Just to be clear I don't need this new mesh to render correctly, as I only need this new mesh for a whole collision instead of parts. so I only need the filter, which I got to save to an actual model as an asset but the model is broken as if it has multiple materials it just deletes any part of the mesh with anything but the first material
@CraigPerko8 жыл бұрын
Yeah, I think I mentioned that multiple materials have to be done carefully. There's a materials array in the MeshRenderer you'll need to use, but that won't work unless the submeshes are being combined correctly, and I don't know if that's done automatically.
@NeonTheCoder8 жыл бұрын
Well I think I am close to getting it, but for some reason I am getting an out of range error, I made it so I iterate through the filters then in that for loop I made a loop that iterates through the submeshes and added each sub mesh as a separate combiner, it should work but for some reason this error pops up. pastebin.com/rh4Ts4Q4
@NeonTheCoder8 жыл бұрын
the exact error is array index is out of range, and it only says the error when It's done iterating, so right before it tries combining the mesh but the error points to the last combiner[a].subMeshIndex that is set instead of the combine command
@CraigPerko8 жыл бұрын
I'm sorry, I don't know what the problem is, but it sounds like you might have a logical flaw in your code. I don't remember having any similar problems when I did similar things. For example, make sure each combiner is pointed at a mesh with the right number of submeshes. If a mesh doesn't have that many submeshes, don't create a combiner for it.
@cfactorygames5 жыл бұрын
Do u know a way to descombine a mesh? I have a mesh with 2 objects inside and I want become in two game objects each!
@CraigPerko5 жыл бұрын
You have to crawl all the edges and do it manually. It's a pain.
@cfactorygames5 жыл бұрын
@@CraigPerko I need it procedural in runtime
@CraigPerko5 жыл бұрын
@@cfactorygames You can do it procedurally during runtime, but you need to program it to do it manually. It's a pain in the butt.
@jeromej.87266 жыл бұрын
Any clue as to why it isn't working in runtime? I'm assuming it might have something to do with the sharedMesh but I haven't been able to figure it out yet. When trying it out in runtime, it just ignore one of the children (or it seems to, anyway) but the vertex count jumps from 60k to 270k somehow.
@CraigPerko6 жыл бұрын
I'm not sure. I think maybe a few things have changed a little in the past two years.
@amoineau6 жыл бұрын
If you ever find a solution I am highly interested !
@LeonardoSilvaHavelock8 жыл бұрын
So if i have an character selection and the user selected one, could i use this to render an mesh in a empty object ?
@CraigPerko8 жыл бұрын
There's no reason to do that, just use a normal MeshRenderer/MeshFilter, and switch which mesh is in the filter.
@Todorv15 жыл бұрын
I have 34 * 120 cubes and i wanted to use your code to stop the "lag" or what ever its called when your game doesn't run smooth. But it turns them into a (probably) 30*10 looking blocks. Why is this happening ?
@Todorv15 жыл бұрын
If anyone has the same problem just add finalMesh.indexFormat = UnityEngine.Rendering.IndexFormat.UInt32;
@CraigPerko5 жыл бұрын
@@Todorv1 TBH, I don't recommend merging cubes. I recommend turning on GPU instancing and marking them as static objects.
@swissmycheese5 жыл бұрын
What is this house building tool?
@EDIshames8 жыл бұрын
Hey I have a problem, I made it up to the 7:10 mark, Unity gives me an error "cant convert type Unity.Engine.MeshFilter to Unity.Engine.MeshFilter[]" I understand what it means by that but for some reason it worked for you. I copied everything you did word for word. Any suggestions?
@CraigPerko8 жыл бұрын
+EDIshames You forgot an "s" in "GetComponentsInChildren"
@EDIshames8 жыл бұрын
+Craig Perko correct, thanks a lot. Still have a few issues here and there but I get the gist of it. Another question though. What if I combine all these meshes in my 3D application before I bring it into Unity? Wouldn't that achieve the same result?
@CraigPerko8 жыл бұрын
Yes! This is mostly useful when you don't know what meshes you're going to need to combine, or you want to be able to adjust how the pieces are placed without going back to Blender. But if you're comfortable in Blender and don't have any advanced needs, do it in Blender!
@WoodCat5 жыл бұрын
Thanks!
@zedgamedev6 жыл бұрын
Can i have multiple houses at different locations using 1 mesh?
@CraigPerko6 жыл бұрын
Of course. Just put the one mesh in several MeshFilters on GameObjects with MeshRenderers. Create some normal cubes and take a look: those are all the same mesh.
@homeslice39645 жыл бұрын
Just skip to 3:00
@sebbes3336 жыл бұрын
Use a zoom function, I can't see anything of the code on my phone
@jstuffss6 жыл бұрын
solution: dont watch i ton a phone, when you're using a pc to program why would you watch it on a phone? or expect everyone to have to deal with his zoom function so that one person can rad it on a phone. cmon
@Levente205 жыл бұрын
and how do you detach meshes?
@chocogreen16 жыл бұрын
Hi there! So... I've been following exactly what you have done in the video, but unity jumps out an error saying: ¬Combine mesh instance 0 is null. UnityEngine.Mesh:CombineMeshes(CombineInstance[ ]) ¬>>>UnityException: Transform child out of bounds WorldGeneration.Combine(at Assets/Script/World Generation/WorldGeneration.cs:169)
@CraigPerko6 жыл бұрын
This is your problem: if(meshFilters[i].transform == Quads.transform) { continue; } It's leaving a hole in your array.
@CJBurkey8 жыл бұрын
Thanks :D
@moshelinke29796 жыл бұрын
error CS0029: Cannot implicitly convert type `bool' to `MeshCombiner'
@CraigPerko6 жыл бұрын
That's a fundamental error in your code, maybe you're using the wrong variables or something.
@ShiftedStriker3 жыл бұрын
I saw how long the vid was and now im scared that im going to get a single thing wrong and ruin it
@rafaelresende54135 жыл бұрын
I need to create a descombiner! Do u know how?
@CraigPerko5 жыл бұрын
You need to crawl each edge and compile them manually.
@jiazq8 жыл бұрын
awesome! have subscribed you !
@juliatran29238 жыл бұрын
My handle isn't showing up in scene view. :(
@EXHOUL4 жыл бұрын
Sometimes the object to which to assign the handle will place it really far away due to its transform parameters. You can always create a new empty child of one of your meshes to combine (so it will have proper transform parameters) and move it so it is parent that has the handle. The handle will appear there for sure :)
@purel24495 жыл бұрын
Combining materials ??
@CraigPerko5 жыл бұрын
You can't combine materials, and there's not too much reason to combine meshes with different materials. It's only useful in very specific situations in the first place, since Unity's gotten pretty good at automatically batching meshes.
@theairaccumulator71446 жыл бұрын
Woo! W?
@ep14172 жыл бұрын
There are much better ways, and this code is not the best way to do it. Doesn't show you how to search children for materials and preserve them.
@Amazingg11005 жыл бұрын
Or you could just abstract yourself of all this stuff by importing this free asset, which is doing this with 3 simple clicks. assetstore.unity.com/packages/tools/modeling/same-material-static-mesh-combiner-139565
@INRamos138 жыл бұрын
Shit I actually needed to export the result mesh... Help, anyone? It's pretty urgent...
@CraigPerko8 жыл бұрын
Exporting it into Unity is pretty easy - just pick a prefab and set the SharedMesh to it. Exporting it as a standalone FBX file is a lot harder. Easiest way is probably to edit the mesh of the saved prefab by double-clicking, if Unity still supports that.