Skip to content

Reimport config JSON when apply LDtkProject file#70

Open
hookSSi wants to merge 1 commit intoCammin:masterfrom
hookSSi:fix/sync-issue-with-config-file
Open

Reimport config JSON when apply LDtkProject file#70
hookSSi wants to merge 1 commit intoCammin:masterfrom
hookSSi:fix/sync-issue-with-config-file

Conversation

@hookSSi
Copy link

@hookSSi hookSSi commented Feb 26, 2026

I modified the code because the changes weren't automatically reflected whenever I modified the LDtkProject file.

I simply reimported the LDtkConfig file. Please let me know if there are any issues.

Fix LDtkProject apply issue with config.

I need to change LDtkConfigData.WriteJson to return the output path and an out bool isChanged.
@Cammin
Copy link
Owner

Cammin commented Feb 26, 2026

I approve because of the application delay call, though I wonder why changes aren't being reflected, because I haven't seen this explicit issue before, at least on a consistent basis. Would be interested in seeing a reproduction. I've tended to avoid application delay calls so there's no potential for duplicate reimports

@hookSSi
Copy link
Author

hookSSi commented Feb 27, 2026

FYI

Environment

OS: Windows 11
Unity: 6000.3.8f1

Reproduce steps

  1. Drag and drop .ldtk
  2. Save levels to separate files
  3. Get some warning and error like

Error:

LDtk: Failed to find the required tileset file at "Assets\New Folder\Level_1\World_1_Floor_1_Tiles.ldtkt". Ensure that LDtk exported a tileset file through a custom command. If the command wasn't configured yet, check the project inspector for more info.

Warning:

Calls to "AssetDatabase.ImportAsset" are restricted during asset importing. Please make sure this function is not called from ScriptedImporters or PostProcessors, as it is a source of non-determinism. This warning will eventually become an exception.
UnityEditor.AssetImporter:SaveAndReimport ()
LDtkUnity.Editor.LDtkProjectImporter:Reset () (at ./Library/PackageCache/com.cammin.ldtkunity@c2fff6ac24a3/Editor/ScriptedImporter/LDtkProjectImporter.cs:98)
UnityEngine.GUIUtility:ProcessEvent (int,intptr,bool&)
This will make levels not update properly when the project is changed in the importer inspector.
UnityEngine.Debug:LogWarning (object,UnityEngine.Object)
LDtkUnity.LDtkDebug:LogWarning (string,UnityEngine.Object) (at ./Library/PackageCache/com.cammin.ldtkunity@c2fff6ac24a3/Runtime/Tools/LDtkDebug.cs:25)
LDtkUnity.Editor.LDtkLevelDependencyFactory:GatherLevelDependencies (string) (at ./Library/PackageCache/com.cammin.ldtkunity@c2fff6ac24a3/Editor/Utility/Dependencies/LDtkLevelDependencyFactory.cs:73)
LDtkUnity.Editor.LDtkLevelImporter:GatherDependenciesFromSourceFile (string) (at ./Library/PackageCache/com.cammin.ldtkunity@c2fff6ac24a3/Editor/ScriptedImporter/LDtkLevelImporter.cs:37)

At this time I couldn't find config file but save again config file was shown

  1. Add prefab to LDtkProjectfile and apply
  2. Prefab not applied at level files Need to reimport config file

@Cammin
Copy link
Owner

Cammin commented Feb 27, 2026

Hi, in general, it's expected to run into a lot of warnings and errors when setting this up. I made sure that all errors guide you towards the next step in the process. Once they are all done, then the errors are cleared up. Also in the docs, there is a setup guide for this. Let me know if you have more questions 🙂

@hookSSi
Copy link
Author

hookSSi commented Feb 28, 2026

Uh... yeah I know that too, but even after setting it up and handling all the warnings and errors this reproduce step still valid. I just wanted to show you the steps to reproduce it. Because If I'm not mistaken, I think you're wondering how to reproduce it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants