https://github.com/mminer/sharptile
C# representation of the Tiled map editor's JSON format.
https://github.com/mminer/sharptile
gamedev tiled tiled-map-editor unity unity3d
Last synced: about 1 month ago
JSON representation
C# representation of the Tiled map editor's JSON format.
- Host: GitHub
- URL: https://github.com/mminer/sharptile
- Owner: mminer
- License: mit
- Created: 2018-05-09T03:31:55.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2018-05-22T01:58:54.000Z (about 7 years ago)
- Last Synced: 2025-04-03T07:38:00.689Z (3 months ago)
- Topics: gamedev, tiled, tiled-map-editor, unity, unity3d
- Language: C#
- Homepage:
- Size: 5.86 KB
- Stars: 8
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Sharptile
C# representation of the [Tiled](https://www.mapeditor.org) map editor's
[JSON format](http://doc.mapeditor.org/en/stable/reference/json-map-format/).
Nothing more, nothing less. This is useful for importing an exported Tiled map
into a C#-based game engine like Unity.There are multiple versions of Tiled's JSON map format. Currently Sharptile
targets version 1.2.## Current Limitations
- Only supports maps with the *Tile Layer Format* property set to **CSV**
- Only supports one JSON map format (currently v1.2)## Using in Unity
While Sharptile is intentionally minimal and uses no Unity APIs, usage in Unity
was the reason for its creation. After adding the *.cs* files to your project,
use an editor script like the following to import a map.```csharp
using Sharptile;
using System.IO;
using UnityEditor;
using UnityEngine;class TiledTest
{
[MenuItem("Tiled/Import Map")]
static void ImportTiledMap()
{
var path = Path.Combine(Application.dataPath, "map.json");
var json = File.ReadAllText(path);
var map = JsonUtility.FromJson(json);
// Do something with the map...
}
}
```Creating the necessary game objects and components to actually *show* the map is
left up to you. For more comprehensive Tiled support in Unity look no further
than [Tiled2Unity](http://www.seanba.com/Tiled2Unity).