Skip to content

Commit

Permalink
cvleaning up import orders to be more readable relative to the docs. …
Browse files Browse the repository at this point in the history
…realizing the separate levels are not importing in parallel
  • Loading branch information
Cammin committed Oct 7, 2023
1 parent c39ef06 commit b4f17b1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
15 changes: 8 additions & 7 deletions Assets/LDtkUnity/Editor/ScriptedImporter/LDtkImporterConsts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,18 @@ internal static class LDtkImporterConsts
public const string LEVEL_EXT = "ldtkl";
public const string TILESET_EXT = "ldtkt";

//choosing a high import order so that any prefab changes respond correctly for the import process, whether prefabs are modified internally in unity or externally (eg. source control)
public const int DEFAULT_PPU = 16;
private const int SCRIPTED_IMPORTER_ORDER = 1000;

//Some discoveries about it to make entity prefabs work as expected: https://forum.unity.com/threads/create-additional-prefab-assets-in-scriptedimporter-and-track-them.1158734/#post-7792380
//Import order is not documented much, but prefab order is 500/501 https://forum.unity.com/threads/understanding-import-order-of-native-unity-asset-types.1187845/
//projects are imported first, so that separate levels can load the project's imported assets. levels will directly load the json for levels instead of loading the imported asset.

//Edit: making prefabs import before projects
public const int TILESET_ORDER = 94;
public const int PROJECT_ORDER = 95;
public const int LEVEL_ORDER = 99; //99 is the secret parallel import value
//Import order https://forum.unity.com/threads/understanding-import-order-of-native-unity-asset-types.1187845/#post-9171509
//Important to reimport before prefabs (1500)
//99 is the secret parallel import value, but doesnt appear to work. maybe in a future update
public const int TILESET_ORDER = 1094 - SCRIPTED_IMPORTER_ORDER;
public const int PROJECT_ORDER = 1095 - SCRIPTED_IMPORTER_ORDER;
public const int LEVEL_ORDER = 1099 - SCRIPTED_IMPORTER_ORDER;

public const int DEFAULT_PPU = 16;
}
}
5 changes: 2 additions & 3 deletions DocFX/documentation/Importer/topic_LevelImporter.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ There are many benefits to using separate level files:
- Helps enable modular level design. (ex. randomly-generated dungeon with levels for dungeon pieces)
- Only modified level files will reimport instead of the project and all levels, resulting in quicker import speeds when applicable
- Only the dependencies involved in a particular level will reimport the level instead of involving all possible dependencies (Entities, IntGrid tiles)
- Only the level assets in the scene are loaded into memory during runtime.
- Level files can be imported simultaneously in parallel, resulting in faster import times when reimporting multiple levels. Available in Unity 2021.2 or higher at `Project Settings > Editor > Asset Pipeline > Parallel Import`

- Only the level assets in the scene are loaded into memory during runtime.
<!-- Level files can be imported simultaneously in parallel, resulting in faster import times when reimporting multiple levels. Available in Unity 2021.2 or higher at `Project Settings > Editor > Asset Pipeline > Parallel Import` -->

For speed reasons, using separate level files is preferable, especially for any larger scale game projects.

Expand Down

0 comments on commit b4f17b1

Please sign in to comment.