Coder Social home page Coder Social logo

freshlybrewedcode / unity-mesh-tilesets Goto Github PK

View Code? Open in Web Editor NEW
75.0 5.0 11.0 10.14 MB

a Unity plugin to place objects along ProBuilder meshes based on rules from tileset. Heavily inspired by the tooling in Source 2.

License: MIT License

C# 100.00%

unity-mesh-tilesets's Introduction

Unity Mesh Tilesets

openupm Last Commit BuyMeCoffee

Unity Mesh Tilesets is a Unity editor extension that can be used to automatically place objects along ProBuilder meshes based on rules from a tileset. The tool is heavily inspired by the tile mesh feature of Valve's Source Engine 2 that was used for many different props in Half Life Alyx.

Showcase

Installation

Mesh Tilesets requires ProBuilder. ProBuilder will be added automatically to your project if it has not been installed yet. It is also highly recommended to install ProGrids as well (note that ProGrids is still in preview so you have to enable preview packages in the package manager).

OpenUPM (recommended)

Make sure you have the OpenUPM CLI installed. From the root of your project run:

openupm add com.freshlybrewedcode.unity-mesh-tilesets

Unity Package Manager

Open the Unity package manager, click on the plus icon in the top left corner and select "Add package from git URL". Paste the following URL into the text field:

https://github.com/FreshlyBrewedCode/unity-mesh-tilesets.git#upm

Note: You will not be able to select a specific version or update the package using this method. If you want to update to the latest version you have to remove the package and add it again using the url above.

Manual Download

Download or clone the repository and add the Assets/Mesh Tilesets folder into the Assets folder of your Unity project.

Getting Started

Check out the getting started section in the documentation.

How It Works

The tool works using primitive meshes that you create and modify directly inside of Unity using ProBuilder. You place the TilesetRenderer component on your tile mesh GameObject and it will find rectangular quads ("tile instances") in the mesh. Each tile instance has an orientation (top, bottom, left, right, normal), a size (width, height) and knows about other adjacent tiles.

You assign a tileset to the TilesetRenderer that can contain any number of tiles. Each tile is basically a prefab that contains information about the size of the tile (width, height) and "rules" about if there can or should be any tiles adjacent to the left/right/top/bottom of the tile.

For each tile instance in the mesh the TilesetRenderer tries to find a tile from the assigned tileset that "fits" (by comparing size and adjacency).

Check out the documentation for more info.

Examples

Here are some example use cases for the tool. I am sure there are many more creative ways to use this tool. If you have a cool example feel free leave a pull request and add it to the list.

Pipes, Tubes

Pipe Example

Ducts, Vents

Duct Example

Railings, Fences

Railing Example

Catwalks, Bridges, Stairs

Catwalk Example

Buildings (almost)

Building Example

Support Me

If you like this tool and you would like to support me, feel free to buy me coffee:

BuyMeCoffee

Thank you :)

Contributing

Pull request welcome.

TODO

License

MIT

The tool can be used freely in any project of any scale. Please don't redistribute the tool through the Unity Assetstore or a similar marketplace.

unity-mesh-tilesets's People

Contributors

freshlybrewedcode avatar semantic-release-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

unity-mesh-tilesets's Issues

The automated release is failing 🚨

🚨 The automated release from the master branch failed. 🚨

I recommend you give this issue a high priority, so other packages depending on you could benefit from your bug fixes and new features.

You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. I’m sure you can resolve this πŸ’ͺ.

Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.

Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the master branch. You can also manually restart the failed CI job that runs semantic-release.

If you are not sure how to resolve this, here is some links that can help you:

If those don’t help, or if this issue is reporting something you think isn’t right, you can always ask the humans behind semantic-release.


Missing package.json file.

A package.json file at the root of your project is required to release on npm.

Please follow the npm guideline to create a valid package.json file.


Good luck with your project ✨

Your semantic-release bot πŸ“¦πŸš€

NullReferenceException with tileOverlay.ShowWindow() in provided sample scene

Upon attempting to do anything on in the sample scene, I get a NullReferenceException when selecting a tileset.

NullReferenceException: Object reference not set to an instance of an object
MeshTilesetsEditor.TilesetRendererEditor.OnSceneGUI () (at Assets/unity-mesh-tilesets-1.0.3/Assets/Mesh Tilesets/Editor/TilesetRendererEditor.cs:173)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at :0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at :0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at :0)
UnityEditor.SceneView.CallOnSceneGUI () (at :0)
UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at :0)
UnityEditor.SceneView.OnGUI () (at :0)
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at :0)
Rethrow as TargetInvocationException: Exception has been thrown by the target of an invocation.
System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) (at :0)
System.Reflection.MethodBase.Invoke (System.Object obj, System.Object[] parameters) (at :0)
UnityEditor.HostView.Invoke (System.String methodName, System.Object obj) (at :0)
UnityEditor.HostView.Invoke (System.String methodName) (at :0)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at :0)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at :0)
UnityEditor.DockArea.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 <78b213560771414e9fa6f1b95f5ad8bb>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
UnityEngine.UIElements.IMGUIContainer.DoIMGUIRepaint () (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
UnityEngine.UIElements.UIR.RenderChainCommand.ExecuteNonDrawMesh (UnityEngine.UIElements.UIR.DrawParams drawParams, System.Boolean straightY, System.Single pixelsPerPoint, System.Exception& immediateException) (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
Rethrow as ImmediateModeException
UnityEngine.UIElements.UIR.RenderChain.Render (UnityEngine.Rect viewport, UnityEngine.Matrix4x4 projection, UnityEngine.UIElements.PanelClearFlags clearFlags) (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
UnityEngine.UIElements.UIRRepaintUpdater.DrawChain (UnityEngine.Rect viewport, UnityEngine.Matrix4x4 projection) (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
UnityEngine.UIElements.UIRRepaintUpdater.Update () (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
UnityEngine.UIElements.VisualTreeUpdater.UpdateVisualTreePhase (UnityEngine.UIElements.VisualTreeUpdatePhase phase) (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
UnityEngine.UIElements.Panel.UpdateForRepaint () (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
UnityEngine.UIElements.Panel.Repaint (UnityEngine.Event e) (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
UnityEngine.UIElements.UIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <78b213560771414e9fa6f1b95f5ad8bb>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <819de1aa368e45faa4f78e26c97c62b0>:0)

which goes to this line

tileOverlay.ShowWindow();

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.