-
-
Notifications
You must be signed in to change notification settings - Fork 32
Description
Current bug behaviour
I have created a tmx file map.tmx located in subfolder city_levels. So assets/tiles/city_levels/map1.tmx.
This file references a tileset as a separate file that on disk is located in the same folder (assets/tiles/city_levels/). If I open up map1.tmx I can see that the relative search path is of current folder. So just the name of the tileset file. Let say city_tileset.tsx.
When I do start my game however I get an error that flame_tiled tries to load asstes/tiles/city_tileset.tsx. Eg. it loads the tileset relative to assets/tiles and not relative to the location of the tmx file.
Expected behaviour
The tileset file is loaded using the path in the tmx file relative to the tmx.
Steps to reproduce
Clone this repo https://github.com/lea108/bug_flame_tiled_tilset_path and start the game.
Explanation how it was created:
- Create a new flutter project
- Create
assets/images/city_levelsandassets/tilesets/city_levelsfolder - Create some images and place in assets/images/city_levels/
- Create a tiled map and save it as map1.tmx in assets/tiles/city_levels/.
- Create a tileset from the map. Make sure to not check the option to store the tilset inside the map file. Save the tileset to assets/tilesets/city_levels (next to map1.tmx file)
- In the tileset add the images created in step 3.
- Save map and tileset.
- Add the asset folders to pubspec.yaml
- Add flame and flame_tiled to pubspec.yaml
- Code a simple game that loads assets/tiles/city_levels/map1.tmx.
Flutter doctor output
[!] Flutter (Channel [user-branch], 3.35.4, on Microsoft Windows [Version 10.0.26100.6725], locale sv-SE) [281ms]
! Flutter version 3.35.4 on channel [user-branch] at C:\Users\Lisette\Programmering\Libraries\flutter
Currently on an unknown channel. Run `flutter channel` to switch to an official channel.
If that doesn't fix the issue, reinstall Flutter by following instructions at https://flutter.dev/setup.
! Upstream repository unknown source is not a standard remote.
Set environment variable "FLUTTER_GIT_URL" to unknown source to dismiss this error.
• Framework revision d693b4b9db (3 weeks ago), 2025-09-16 14:27:41 +0000
• Engine revision c298091351
• Dart version 3.9.2
• DevTools version 2.48.0
• Feature flags: enable-web, enable-linux-desktop, enable-macos-desktop, enable-windows-desktop, enable-android, enable-ios,
cli-animations, enable-native-assets, enable-lldb-debugging
• If those were intentional, you can disregard the above warnings; however it is recommended to use "git" directly to perform update
checks and upgrades.
[✓] Windows Version (11 Home 64-bit, 24H2, 2009) [4,1s]
[✓] Visual Studio - develop Windows apps (Visual Studio Community 2022 17.14.12) [74ms]
• Visual Studio at C:\Program Files\Microsoft Visual Studio\2022\Community
• Visual Studio Community 2022 version 17.14.36408.4
• Windows 10 SDK version 10.0.26100.0
More environment information
- Tiled version: 3.0.7
- Platform affected: windows (other platforms has not been tested)
- Platform version affected: windows 11
Log information
════════ Exception caught by widgets library ═══════════════════════════════════
The following assertion was thrown building FutureBuilder<void>(dirty, state: _FutureBuilderState<void>#e7040):
Unable to load asset: "assets/images/../../images/city_levels/tile1.png".
The asset does not exist or has empty data.