Git Product home page Git Product logo

ldtktounity's Introduction

LDtkToUnity
OpenUPM Compatibility GitHub Repo stars Hits Downloads Discord

A Unity importer system for deepnight's LDtk.

Discord
Install
Documentation
Changelog
Survey
Trello
OpenUPM
KoFi

It's a simple drag and drop!
DragNDrop

Features

  • Uses ScriptedImporters to import LDtk files, and re-imports when the LDtk project saves
  • Animated Tiles!
  • Collision options
  • Entity prefab replacements
  • Imports fields from entities and levels
  • Automatic enum script generation
  • Custom Post-import scripting to customize the import result (API)
  • Properties and functions for LDtk data for better Unity context (API)
  • Separates Tileset generation to optimize import speeds, and pack into a SpriteAtlas
  • Supports separate level files
  • Supports Unity's Configurable Enter Play Mode
  • Fully documented

Can add separate level files too!
Drag-N-Drop

If you have any questions/problems then post an issue; I'd gladly take any feedback.
Alternatively, contact me at [email protected], the Discord server, or Twitter @CKrebbers.

If you like this importer, consider signing a survey for feedback or donate.
If you make a game using this, then I'd be happy to check it out! Showcase your work on the Discord server or give me a shout-out on Twitter.

Premise & Review

This importer started as an attempt to produce levels in an easy and streamlined fashion. When searching for a solution to mass-produce levels, I discovered LDtk, as its really fun to use and is relatively young. I started working on a personal level importer, but after noticing how convenient and standalone the importer has become, I took it upon myself to make this a public repo as a package! I enjoy it's production, and learning a lot in the process.

Opacity

ldtktounity's People

Contributors

cammin avatar caspark avatar haelle avatar semantic-release-bot avatar senpierre 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  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  avatar  avatar  avatar  avatar  avatar  avatar

ldtktounity's Issues

Importer logs warnings when reimporting a LDtk asset that's part of a prefab

Summary

If your LDtk asset is part of a prefab, the importer will log warnings that names are not unique and that subsequent imports may not properly re-link.

Steps to reproduce

1. Add a LDtk asset under an empty parent object, make that parent object a prefab.

image

2. Reimport the LDtk asset.

image
Warnings are logged to the console.
image

Stuff that might help

Warnings logged to the console:

Creating missing Tilemap component for TilemapCollider2D in Missing Prefab (Dummy).

Creating missing Tilemap component for TilemapCollider2D in Missing Prefab (Dummy).

Identifier uniqueness violation: 'Name:6705443923001353219/Gunsmith Dungeon (Missing Prefab)/Missing Prefab (Dummy), Type:GameObject'. Multiple Objects with the same name/type are generated by this Importer. There is no guarantee that subsequent imports of this asset will properly re-link to these targets.

Identifier uniqueness violation: 'Name:6705443923001353219/Gunsmith Dungeon (Missing Prefab)/Missing Prefab (Dummy), Type:GameObject'. Multiple Objects with the same name/type are generated by this Importer. There is no guarantee that subsequent imports of this asset will properly re-link to these targets.

Identifier uniqueness violation: 'Name:6705443923001353219/Gunsmith Dungeon (Missing Prefab)/Missing Prefab (Dummy)/Transform, Type:Transform'. Multiple Objects with the same name/type are generated by this Importer. There is no guarantee that subsequent imports of this asset will properly re-link to these targets.

Identifier uniqueness violation: 'Name:6705443923001353219/Gunsmith Dungeon (Missing Prefab)/Missing Prefab (Dummy)/Tilemap, Type:Tilemap'. Multiple Objects with the same name/type are generated by this Importer. There is no guarantee that subsequent imports of this asset will properly re-link to these targets.

Identifier uniqueness violation: 'Name:6705443923001353219/Gunsmith Dungeon (Missing Prefab)/Missing Prefab (Dummy), Type:GameObject'. Multiple Objects with the same name/type are generated by this Importer. There is no guarantee that subsequent imports of this asset will properly re-link to these targets.

Identifier uniqueness violation: 'Name:6705443923001353219/Gunsmith Dungeon (Missing Prefab)/Missing Prefab (Dummy)/Transform, Type:Transform'. Multiple Objects with the same name/type are generated by this Importer. There is no guarantee that subsequent imports of this asset will properly re-link to these targets.

Identifier uniqueness violation: 'Name:6705443923001353219/Gunsmith Dungeon (Missing Prefab)/Missing Prefab (Dummy)/Tilemap, Type:Tilemap'. Multiple Objects with the same name/type are generated by this Importer. There is no guarantee that subsequent imports of this asset will properly re-link to these targets.

ILDtkImportedLevel's OnLDtkImportLevel not invoked

I specified a level prefab for an LDtk file, and that prefab had a behavior that implemented the ILDtkImportedLevel interface, but its OnLDtkImportLevel function was never called. On the other hand, the same script also implemented ILDtkImportedFields, and its OnLDtkImportFields function was called.

I believe it can be fixed by swapping line 159 and line 162 of Editor/LDtkBuilderLevel.cs (though I've only briefly looked at the source code, so I'm not 100% sure).

Before:

if (addedFields)
{
    LDtkInterfaceEvent.TryEvent<ILDtkImportedLevel>(monoBehaviours, levelComponent => levelComponent.OnLDtkImportLevel(level));
}

LDtkInterfaceEvent.TryEvent<ILDtkImportedFields>(monoBehaviours, levelComponent => levelComponent.OnLDtkImportFields(lDtkFields));

After:

if (addedFields)
{
    LDtkInterfaceEvent.TryEvent<ILDtkImportedFields>(monoBehaviours, levelComponent => levelComponent.OnLDtkImportFields(lDtkFields));
}

LDtkInterfaceEvent.TryEvent<ILDtkImportedLevel>(monoBehaviours, levelComponent => levelComponent.OnLDtkImportLevel(level));

LDtkIntGridTile settings bug

This seems like a bug.

In LDtk if you have 2 IntGrid Lyaers

Ground
Water

and in unity you set these up to be:

Ground => LDtkIntGridTile_Ground
Water => LDtkIntGridTile_Water

Then in LDtk you decide to add another IntGrid layer to the top:

Coulds_Oneway
Ground
Water

Then in unity you wind up with this:

Clouds => LDtkIntGridTile_Ground
Ground => LDtkIntGridTile_Water
Water => Default

Eg: All of your LDtkIntGridTile settings get offset and wind accounted with the wrong layers.

Add option to set the composite collider geometry type on import

The Composite Collider Geometry Type defaults to Outlines. This is problematic as using an IntGrid as a trigger area (i.e. for checking if the player is inside water) doesn't work since only the outline collides in that mode.

My current workaround is to change the geometry type every time I add a level, but this is tedious, especially if I ever have to add an ldtk file to a different scene for any reason (since I would then have to go into all of the levels and switch the geometry type). Alternatively I could turn off Composite Colliders, but that presumably has a performance cost.

Could the Geometry Type option be added to the importer so that I don't have to manually change it for every new level?

Collision with mirrored rules for non-square tiles

I'm unsure if this is supported hence the issue. If it is supported please share how to use it in Unity.

In LDtk I have an IntLayer with a bunch of rules. There are 2 grid values:
0: solid blocks
1: 45 degree angle slopes

This allows me to paint a level including slopes. The tileset is setup in such a way that tiles are mirrored, hence rules are also setup that way.
Slopes both ascending and descending are then automatically painted in using a single rule (with mirror x,y enabled) on the grid value 1.

In Unity I have to apply an LDtkIntGridTile to each of the grid values. On value 0 it's easy. A single block with a square collision shape. For grid value 1 I have a single 45 degree ascending slope with custom collision shape. But for the slopes I notice that 2 things are not working:

  1. The collision shape doesn't match the slope, but it just remains a full block.
  2. The collision shapes are not mirrored like the tiles are. That would imply I need a new grid layer, and a new LDtkIntGridTile for each mirror-version of each non-block based tile.

Is it true this is not supported, or am I missing something obvious?

How would that work with more complicated shapes? E.g 33.3 degree slopes spanning multiple tiles to reach to 1 block height?

Help getting access to custom tile data

Hi. Apologies for the noob question but I'm coming up against a brick wall here.

I have a tileset "Ground" which has custom data for each tile using the following schema...

{
  "movementSpeed": 0.8
}

I've imported the world into unity and put the level in the scene. In code I can get the tile under the player's current position...

public class PlayerController : MonoBehaviour
{

    Rigidbody2D body;
    Tilemap ground;
    private float horizontal, vertical;
    private readonly float runSpeed = 1.0f, moveLimiter = 0.7f;

    void Start()
    {
        body = GetComponent<Rigidbody2D>();
        ground = GameObject.Find("Ground").GetComponentInChildren<Tilemap>();
    }

    private void FixedUpdate()
    {
        Vector3Int position = Vector3Int.RoundToInt(body.position);
        TileBase tile = ground.GetTile(position);
    }
}

But from here I am drawing a blank on how to access the custom data associated with this tile. Any help is much appreciated. Thanks for the excellent project so far it has been very useful.

Tile resolution from asset PixelPerUnit, and plugin interface.

Hey,

Following up from a conversation on the LDtk discord.

Turns out you've made a bunch of changes to the project since I grabbed the source, so making a PR wouldn't be trivial. Here's a patch of the changes instead if you want to take a look.

ldtk-asset-proc-changes.patch.txt

This includes 2 changes:

  1. Pulling the tile resolution from the Unity Texture Asset
  2. A simple extension pattern to allow defining a path mapper outside of the LDtk source

These changes allow remapping of the tileset art to a different file, with a different tile resolution, allowing the use of HD tilesets (keeping low-res tilesets in LDtk which doesn't support high-res tiles).

Here's what the path mapper looks like on my side:

[InitializeOnLoad]
public static class AssetProcessingExtensionsInitializer {
  static AssetProcessingExtensionsInitializer() {
    Debug.Log("AssetProcessingExtensionsInitializer");
    AssetProcessingExtensions.RegisterAssetPathMapper(new AssetPathMapper());
  }
}

public class AssetPathMapper : IAssetPathMapper {
  public string MapAssetPath(string path) {
    var outPath = path;
    if (outPath.EndsWith("SD.png")) {
      var hd = outPath.Replace("SD.png", "HD.png");
      if (File.Exists(hd)) {
        outPath = hd;
      }
    }
    if (path != outPath) {
      Debug.Log($"Remapped {path} to {outPath}");
    }
    return outPath;
  }
}

Conflict with Odin Inspector when drawing arrays

Whenever Odin is active and an array with the LDtkField attribute is drawn on the inspector, a weird graphic bug happens.
The ldtk icon d_SimpleIcon.png gets drawn everywhere and every tooltips get messed up.

With Odin active and no arrays opened, everything is working as expected:
odin and arrays not opened

But as soon as you open an array:
odin and array opened

And that icon is drawn every where in Unity:
Screenshot 2021-05-13 144344

Also the tooltip gets drawn at the bottom of the inspector (it was working well before opening up the array):
tooltip position

I did a temporary fix to quickly solve the issue on my side, but I'd rather have a proper fix if possible:

// Inside LDtkUnity/Editor/LDtkFieldAttributeDrawer.cs
public override void OnGUI(Rect position, SerializedProperty property, GUIContent label)
{
#if ODIN_INSPECTOR
    if (property.name != "data") {
        label.image = LDtkIconLoader.LoadSimpleIcon();
        label.tooltip = "'This field is sed by LDtk";
     }
#else
      label.image = LDtkIconLoader.LoadSimpleIcon();
      label.tooltip = "'This field is sed by LDtk";
#endif
    EditorGUI.PropertyField(position, property, label);
}

[Feature Request] HotReload support

I am using HotReload in my project and when it is turned on the import process of the LDtk project is not triggered every time i save it in LDtk. I get the notification that everything has been imported but the levels did not update and post processors did not trigger.

Because of the nature of HotReload asset, it only reimports when the code change affects the editor thus breaking the import process in Unity.

Collision is not working.

I have no idea if this is me doing something wrong, but collision just straight up doesn't work. The player just falls through the map. I've tried manually adding the player prefab and using it as an entity and nothing has worked. I have a capsule collider 2d and a rigidbody 2d on my player, and as far as I can tell the tilemap collider was set up properly when it was generated.

Unity GUID error

updated LDtkUnity today and now I'm getting this error:

GUID [8c4bfcb5b17948478ccb955bccff9652] for asset 'Packages/com.unity.nuget.newtonsoft-json/Runtime/Newtonsoft.Json.dll' conflicts with:
  'Packages/jillejr.newtonsoft.json-for-unity/Plugins/Newtonsoft.Json Editor/Newtonsoft.Json.dll' (current owner)
We can't assign a new GUID because the asset is in an immutable folder. The asset will be ignored.

Looks like LDtkUnity installed jillejr.newtonsoft.json-for-unity and it's conflicted with the built in com.unity.nuget.newtonsoft-json.

Not sure what to do about this.

Entity Prefabs disconnect from LDtk project upon saving a prefab

Something I've noticed while working on a game in my own time.
When I save a prefab (essentially reimporting the prefab), the prefabs that were associated as entities in the LDtk project are broken, and an empty GameObject sits in their place as an entity instead. I reimport the LDtk project to fix the issue, but any objects that references the entity within the scene is lost too, so values would need to be re-linked.
This is a high priority issue. It should be fixed in the next update.

Entity prefabs don't align correctly

I'm not sure how to fix this without doing something weird.

In LDtk I make an Entity the same size as the gameobject/prefab I want to replace it with:
LDTK

However when LDtkToUnity imports it and places the prefab it doesn't place it to the same alignment, instead it seems to center it on the left corner at the pivot point set in LDtk.

I've tried playing around with the Pivot point options in LDtk, but none of them provide a result that keeps the prefab aligned to the grid.

result in unity

Centered result:
Result of centered pivot point

The only kind of okay way I've found to do it is to use a default 1x1 grid sized entity and center the pivot, but this is kind of unpleasant to work with in LDtk since it means when I have big or even huge entities they still have to be represented by a 1x1 square.

Only working result

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 can benefit from your bug fixes and new features again.

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 fix 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 are 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 📦🚀

LDtkUnity.Example already exists

Hello Cammin,
Thanks you and good luck to continue this package on Unity, it will be well received by the community. When we install the package by UPM (modification of the manifest), we get the runtime + Samples. Impossible to get the Samples via package manager/Samples/import, otherwise we have the following message in theconsole Assembly console with name 'LDtkUnity.Example' already exists (Packages/com.cammin.ldtkunity/Samples/Example/LDtkUnity.Example.asmdef)
Capture

Assembly error - again

Hi, sorry but on another place.

Assets\Tests\Editor\FieldDeserializeTest.cs(7,7): error CS0246: The type or namespace name 'Samples' could not be found (are you missing a using directive or an assembly reference?)

I have used fresh code from github rep. and with Unity 2020.3.0f1 LTS.

Individual level files not working

First of all, thank you very much for making this plugin. I can see there is a lot of work that went into this! Thanks for that.

I was wondering if the "individual level file" feature should still work, because I can't get it to work in my environment.

  • When using the project file, everything gets imported correctly and works as expected
  • When changing the LDtk setting to "Save levels to separate files" and checking those individual ldtkl files in the Unity project view, those do not have the expected game objects under them, just look like this:

image

I am using

  • Unity 2021.2.8
  • LDtkToUnity 2.1.8
  • LDtk 0.9.3

Am I doing something wrong?

Tile gap help

For some reason I can't figure out how to get LDtkUnity to not put a transparent gap between tiles.

attached a photo of the issue in unity, and a photo of what it looks like in LDtk.

gap
Looks like in LDtk

Help getting started please

With no documentation for version 2 I am having a heck of a time getting started.

Could someone give me a quick and dirty how to, to re-make the AutoLayers_1_basic example?

I tried taking the AutoLayers_1_basic ldtk file saving as a new file, then import it back in and collision no longer works, and I can't figure out were the atlases are being generated to.

V1 -> V2 help

I used V1 for a small project and it worked well, I'm trying to use v2 for another project and I'm completely lost.

I can get the LDTK file in the Unity and drag it into the scene, but it doesn't seem to act like a proper tile map. If you go into the tile map painter it doesn't have any of the actual titles used just some defaults, if I add a tilemap collider to it doesn't work at all.

tldr:
V1 colider's just worked once you got them setup, now I can't figure out how to get tilemap collider's to work.

Linux support

Is it supposed to work on Linux?
I have an error when saving the LDtk project.
I'm pretty sure it's because I cannot run a .exe file ☺️

I'll try to make a Linux build. Do I need advices ?

EDIT: actually this issue should be there : https://github.com/Cammin/LDtkTilesetExporter

Unity 2021.2 API Incompatibility

I also posted this in the LDtkToUnity discord server, but just to let anyone know who's wondering:

Unity 2021.2 came out very recently. There are a couple API incompatibilities that LDtkToUnity has with 2021.2, but it's fixed and will be coming in the next update. It should be coming relatively soon!

composite collider

Hey Cammin, GREAT WORK!
Your 2.0 version just brings LDtktoUnity into another level!
Just one quick question, can I generate Composite Collider 2D by default instead of only Tilemap Collider 2D?

[Feature Request] Support External Enums which are imported.

Current version: LDtkToUnity v3.1.3

The imported enums has different data path from the built-in enums of LDtk.
Could we also support external Enums?
external Enums allow us maintian the full Enums list in an external file and import/refresh from that file, which is more feasible for a serious project.

Can't select Grid prefab for project

I'm trying to use a different grid prefab for my levels, but the selector for Grid Prefabs isn't showing any assets, not even the default LDtkDefaultGrid. I'm guessing it can't see the prefabs because they're a GameObject and just contain a Grid, whereas the asset picker is filtering for type Grid.

Name fix

It's deepnight without k :)
Thank you for your Unity integration!

Scene drawing breaks when a scenes are unloaded

Summary:

Drawing of the scene handles, texts, etc. breaks when a scene was added to the hierarchy additively and is then unloaded.

Steps to reproduce:

1. Create a new scene, add a LDtk asset to it.

Unity_2021-07-09_14-30-04

2. Create a second scene, add it to the hierarchy additively.

(e.g. by dragging it under the current scene) The drawing still works.

Unity_2021-07-09_14-32-07

3. Unload the second scene.

(right click -> unload scene) Drawing breaks, exceptions are logged to the console.

Unity_2021-07-09_14-32-15

Unity_2021-07-09_14-30-31

Stuff that might help:

Exception that is logged to the console:

ArgumentException: The scene is not loaded.
UnityEngine.SceneManagement.Scene.GetRootGameObjects (System.Collections.Generic.List`1[T] rootGameObjects) (at <ef667cdc82bf4a4e911d1ddea9ff581d>:0)
UnityEngine.SceneManagement.Scene.GetRootGameObjects () (at <ef667cdc82bf4a4e911d1ddea9ff581d>:0)
LDtkUnity.Editor.LDtkFindInScenes.FindInScene[T] (UnityEngine.SceneManagement.Scene scene) (at Library/PackageCache/[email protected]/Editor/CustomEditor/SceneDrawer/LDtkFindInScenes.cs:37)
LDtkUnity.Editor.LDtkFindInScenes.FindInAllScenes[T] () (at Library/PackageCache/[email protected]/Editor/CustomEditor/SceneDrawer/LDtkFindInScenes.cs:24)
LDtkUnity.Editor.LDtkSceneDrawer.DrawEntityDrawers () (at Library/PackageCache/[email protected]/Editor/CustomEditor/SceneDrawer/LDtkSceneDrawer.cs:44)
LDtkUnity.Editor.LDtkSceneDrawer.CustomOnSceneGUI (UnityEditor.SceneView view) (at Library/PackageCache/[email protected]/Editor/CustomEditor/SceneDrawer/LDtkSceneDrawer.cs:19)
UnityEditor.SceneView.CallOnSceneGUI () (at <015079d9a4ea4f97b4381e694d2310c1>:0)
UnityEditor.SceneView.HandleSelectionAndOnSceneGUI () (at <015079d9a4ea4f97b4381e694d2310c1>:0)
UnityEditor.SceneView.OnGUI () (at <015079d9a4ea4f97b4381e694d2310c1>:0)
UnityEditor.HostView.InvokeOnGUI (UnityEngine.Rect onGUIPosition, UnityEngine.Rect viewRect) (at <015079d9a4ea4f97b4381e694d2310c1>:0)
UnityEditor.DockArea.DrawView (UnityEngine.Rect viewRect, UnityEngine.Rect dockAreaRect) (at <015079d9a4ea4f97b4381e694d2310c1>:0)
UnityEditor.DockArea.OldOnGUI () (at <015079d9a4ea4f97b4381e694d2310c1>: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 <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, UnityEngine.Matrix4x4 worldTransform, UnityEngine.Rect clippingRect, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Action onGUIHandler, System.Boolean canAffectFocus) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.IMGUIContainer.HandleIMGUIEvent (UnityEngine.Event e, System.Boolean canAffectFocus) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUIRaw (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.IMGUIContainer.SendEventToIMGUI (UnityEngine.UIElements.EventBase evt, System.Boolean canAffectFocus, System.Boolean verifyBounds) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.EventDispatchUtilities.PropagateToIMGUIContainer (UnityEngine.UIElements.VisualElement root, UnityEngine.UIElements.EventBase evt) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.EventDispatchUtilities.PropagateToIMGUIContainer (UnityEngine.UIElements.VisualElement root, UnityEngine.UIElements.EventBase evt) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToIMGUIContainer (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.MouseEventDispatchingStrategy.SendEventToTarget (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.BaseVisualElementPanel panel) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.MouseEventDispatchingStrategy.DispatchEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel iPanel) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.EventDispatcher.ApplyDispatchingStrategies (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, System.Boolean imguiEventIsInitiallyUsed) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.EventDispatcher.ProcessEvent (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.EventDispatcher.Dispatch (UnityEngine.UIElements.EventBase evt, UnityEngine.UIElements.IPanel panel, UnityEngine.UIElements.DispatchMode dispatchMode) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.BaseVisualElementPanel.SendEvent (UnityEngine.UIElements.EventBase e, UnityEngine.UIElements.DispatchMode dispatchMode) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.UIElementsUtility.DoDispatch (UnityEngine.UIElements.BaseVisualElementPanel panel) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.UIElementsUtility.UnityEngine.UIElements.IUIElementsUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& eventHandled) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.UIEventRegistration.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.UIElements.UIEventRegistration+<>c.<.cctor>b__1_2 (System.Int32 i, System.IntPtr ptr) (at <1fd6bc3af931450b977286a218b046fb>:0)
UnityEngine.GUIUtility.ProcessEvent (System.Int32 instanceID, System.IntPtr nativeEventPtr, System.Boolean& result) (at <6ddf8eac3856492ab1b8cf42618915cc>:0)

Rectangle entity grid size mismatch

Hello, thank you for this amazing tool!

image
I have two layers, one IntGrid with rules and one Entity layer.

The IntGrid layer has a grid size of 16 and the Entity layer is 8.

image
Snapping a rectangle entity on the 8x8 Entity layer works as expected in LDtk.

image
When importing into Unity, the rectangle entity is twice the size it should be.

image
If I change the grid size of the Entity 8x8 layer to 16 before saving...

image
... the imported size is correct.

image

IntGrid Value -> Different Unity Layers

One of the best things about LDtk is the auto-generation rules you can make by having complex Intgrids value layers to automate a lot of level design.

I'm running into the issue that I need different IntGrid value layers to be on different Unity layers, which seems impossible since all Intgrid values all get lumped under a single imported IntGrid gameobject.

Wouldn't it make sense for a lot of project layouts if the IntGrid value layers where children of IntGrid gameobject? That way they could have their own unique tags and layers assigned to them in Unity.

example

I realize you can place prefabs on them that then have grid sized objects with their own tags and layers, but this has the issue that they can't be used with a composite collider.

Specifically I'm having the issue that I have an Intgrid set up with two value layers:

IntGrid [Base]
1: Ground
2: Water

And I need ground to be on the Platform layer in unity, whereas I need water to be on the Water layer, I also need them both to be composite colliders to avoid seams that cause issues with the physics system.

I can* make them in their own IntGrids and have them work, but then the water and ground can't be "smart" eg: I can't create rules where if ground is bordering water it uses x edge...etc.

Runtime Level Editing

Hey @Cammin!

We absolutely love your work and we currently try to implement runtime level editing for easy/quick iteration and maybe later on for our players. How hard would it be to get this to work? Or back to work (I read that it was considered once!)

It would definitely require the rules to resolve at runtime, but what else would be required to make it all work completely?

Kind regards,
Max

Runtime AutoRules

I want to change the tileset at runtime, such as changing the grass to dirt, is there a way to automatically change the neighbor tileset according to the autorules? Or any function I can call to get neighbor tilesets definition from my current changed one.

Possible to get animated tiles?

Since LDtk has yet to implement animated tiles, I was wondering whether there was a possibility to inject an animated tile during the import process. The usecase is an animated water tile. I'd appreciate any ideas!

Compile Error

Assets\Tests\Editor\FieldDeserializeTest.cs(5,17): error CS0234: The type or namespace name 'Test_file_for_API_showing_all_features' does not exist in the namespace 'LDtkUnity' (are you missing an assembly reference?)

Originally posted by @AndyGFX in #3 (comment)

Weird Coloring issue.

I'm just testing things out using the Cavernous tile set that comes with LDtk and I'm getting this weird coloring issue. In LDtk the lava looks like this.

image

But in Unity it looks like this.
image

You can see the line in the lava in the Unity version where the colors are supposed to be the same. Also it's a lot blurrier. I'm assuming there's a conversion problem somewhere. I'm using a sprite atlas, so maybe in the creation of the sprites it's causing it. Not sure.

Potential major rework

There is a similar tool like this one but for tiled: https://github.com/Seanba/SuperTiled2Unity

After looking over its strategy compared to this package, I'm considering some inspiration from it into the import process of a .ldtk asset in unity, where the import process builds a ready-to-use drag-n-drop "prefab" that automatically regenerates itself whenever the .ldtk level is saved (similar to a .fbx model imported into unity). This would involve a major rework to the entire setup process, but I'm interested in exploring this route, as it would greatly simplify the asset setup for the user, and allow automatic refreshes of a .ldtk project without any extra manual work which furthers the simplification.

I can imagine that the simplification can remove the need to manage tile collections, assigning textures/levels/background textures, and anything else that could be otherwise managed by the user which could be automated, while still offering some degree of customization as well.

My primary goal is to make this as simple as humanly possible for the end-user.

I'd be interested in some discussion, so If you have any thoughts about UX, asset setup, AssetImporter advice, etc, drop them here.

Optionally don't import the background color as a separate layer

I don't need the background color layers in my current project - it would be great to be able to uncheck an option somewhere that said "Import background color as a layer" or something like that.

Failing that, an option to set the Order In Layer for the BG color layer to -99999 😄

Love this project!!

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.