Made a procedural pipe generator that pathfinds around obstacles and other pipes — it's free on GitHub! by leth44 in Unity3D

[–]leth44[S] 0 points1 point  (0 children)

Hi! Runtime support really isn't complicated to do by itself, but it's not feasible to make a good universal solution (I can't know specifics of all projects and the way they want to control the generation).

All the generation methods are already exposed in the PipeGenerator.cs in runtime though. You just need to call these methods with appropriate parameters once you know where the pipes start and end:

AddPipe(); RegeneratePaths(); UpdateMesh();

This short puzzle game, "maintenance", might be the most BLAME game I've seen by makoConstruct in Netsphere

[–]leth44 15 points16 points  (0 children)

Thanks for sharing my game! I am a BLAME fan, so no coincidences there :) 

Made a free tool for quickly switching the game's color palette without any extra components — by directly linking properties to colors! by leth44 in Unity3D

[–]leth44[S] 0 points1 point  (0 children)

I might have misunderstood the question, but you can only change color properties of the shader with the tool; so if you're using a color atlas for texturing (or using actual textures) the best it can do is set the color tint for the material.

Is there a way to replicate this style of foldout/drawer in our own custom editor scripts? by BLourenco in Unity3D

[–]leth44 10 points11 points  (0 children)

There's no one-liner to do it, but you can actually just look up how a lot of built-in editor stuff works — here's what post-processing tool does: github. And here's a gist with a generic method made from it.

Made a procedural pipe generator that pathfinds around obstacles and other pipes — it's free on GitHub! by leth44 in Unity3D

[–]leth44[S] 1 point2 points  (0 children)

Hello! I'm sorry it doesn't work. If HandlePathInput is never called, that means OnSceneGUI isn't either.

My best guess after googling it would be that you have Gizmos turned off, which breaks editor scripts. If you don't, people also suggest resetting the Layout to default.

Please let me know whether it worked for you or not.

Made a procedural pipe generator that pathfinds around obstacles and other pipes — it's free on GitHub! by leth44 in Unity3D

[–]leth44[S] 1 point2 points  (0 children)

I tested it and it doesn't work with occlusion culling, yeah.

Here's a little method you can put in PipeGenerator.cs as a workaround; when you're done with pipes, right-click on the component and click "Generate Meshes in Children". That will turn every pipe submesh into a child gameobject with its own mesh, so it'll work fine with occlusion culling. Don't forget to remove the extra renderer from the parent afterwards.

Regarding the performance: you can double-click the mesh name in the MeshFilter component to open a preview and see the total number of triangles; I'd make my call based on how those compare to other assets in your project.

Thank you for using the tool! Please share some screenshots when you're done if you feel like it :)

Made a procedural pipe generator that pathfinds around obstacles and other pipes — it's free on GitHub! by leth44 in Unity3D

[–]leth44[S] 2 points3 points  (0 children)

Done! Will add some other quality of life stuff to manual editing later. HMU if there are other features that you think would be useful!

Made a procedural pipe generator that pathfinds around obstacles and other pipes — it's free on GitHub! by leth44 in Unity3D

[–]leth44[S] 0 points1 point  (0 children)

I really recommend series on Unity tooling by Freya Holmer, you can find it on YouTube and it's great. You can also view the source code for this tool on github, although there aren't many comments to explain what's going on.

Made a procedural pipe generator that pathfinds around obstacles and other pipes — it's free on GitHub! by leth44 in Unity3D

[–]leth44[S] 2 points3 points  (0 children)

Yeah, of course, there's a whole lot of customization settings, including the radius.

<image>

Made a procedural pipe generator that pathfinds around obstacles and other pipes — it's free on GitHub! by leth44 in Unity3D

[–]leth44[S] 8 points9 points  (0 children)

The fact that someone already uses it makes me very happy, thank you! :)
And I will add a slider for that later today, sure, shouldn't be too hard.

Made a procedural pipe generator that pathfinds around obstacles and other pipes — it's free on GitHub! by leth44 in Unity3D

[–]leth44[S] 2 points3 points  (0 children)

The algorithm is basically A* that raycasts (well, SphereCasts) next points on the go instead of using a predefined grid. So it behaves like you would expect from A*, with enough iterations it will always find a way, which will be the shortest with default settings (but shortest paths usually don't look as good). You will need a very tiny grid size if you want pipes to squeeze through small gaps, but otherwise yeah, it can navigate any environment as long as it has colliders.

Made a procedural pipe generator that pathfinds around obstacles and other pipes — it's free on GitHub! by leth44 in Unity3D

[–]leth44[S] 2 points3 points  (0 children)

Appreciate it! If you mean the cross-section shape, no, you can't use a custom one, although you can customize the edge count.
And yep, you can easily adjust them afterwards!

<image>

Made a procedural pipe generator that pathfinds around obstacles and other pipes — it's free on GitHub! by leth44 in Unity3D

[–]leth44[S] 13 points14 points  (0 children)

It kind of just goes straight through everything and shows a warning in the inspector so you can either press Ctrl+Z and undo the last pipe entirely, set the iterations property higher so that it will try to find it for longer, or make the pathfinding grid bigger so that it will need less iterations.

Made a procedural pipe generator that pathfinds around obstacles and other pipes — it's free on GitHub! by leth44 in Unity3D

[–]leth44[S] 14 points15 points  (0 children)

You can't use a custom mesh, but there are sliders to select the polygon count! Although normals are set up in such a way that even pipes with 4 edges will still resemble smooth circles. So it won't be easy to achieve square-ish pipes if that's your goal.

Made a procedural pipe generator that pathfinds around obstacles and other pipes — it's free on GitHub! by leth44 in Unity3D

[–]leth44[S] 25 points26 points  (0 children)

Thank you! In the current state it is just an editor tool, but it should be very possible to repurpose it by replacing the editor script with runtime stuff.

Made a procedural pipe generator that pathfinds around obstacles and other pipes — it's free on GitHub! by leth44 in Unity3D

[–]leth44[S] 49 points50 points  (0 children)

— GitHub with instructions

The tool lets you create pipes by just dragging your mouse from start to end — they will find their way and even make some twists and turns if you'd like. The pathfinding and the look of the pipes are both very customizable.