【unity插件】Tiled2Unity-非常方便的将Tiled导入到unity3d

在找tiled for unity相关插件的时候,偶然发现一个非常棒的插件,就是Tiled2Unity(点击进入官网),并且这款插件完全免费!!!而且支持的功能真是太良心了!在Tiled编辑好地图之后一键发送到unity,非常之方便。而且提供的unity脚本拓展性非常强。



支持的功能如下:

Features:

  • Builds a Unity prefab out of your TMX map file
  • Supports all TMX layer formats (XML, CSV, Base64, gzip/zlib compressed)
  • Multiple layers and tilesets supported
  • Exports Object Layer as polygons, polylines, rectangles, circles
  • Tile Layer collisions supported (with slopes, odd-shaped polygons)
  • Polygon colliders can be concave, have holes, and be composed of separate polygons
  • Can assign Tag, Sorting Layer, Order in Layer, and (Physics) Layer of exported GameObjects through properties in Tiled
  • Support for customized creation of Unity Prefabs
  • Easy to use: In most cases, you simply export a TMX file into your Unity project and place the automatically generated prefab in your scene – no further edits needed

使用说明和功能介绍看这里:点我

使用示例看这里:点我

Learning Tiled2Unity

I’ve tried to make Tiled2Unity simple to use and understand. Here’s some links that may help you out:

  • Introduction: Use the test TMX files supplied with Tiled2Unity to create two simple scenes in your Unity project (one with sloped collision).
  • Tiled2Unity Scale: By default, Unity 2D sprites use a coordinate system where 100 pixels equals 1 unit in Unity. I think that’s crazy but this link will show you how to live in that world.
  • Mega Dad Adventures: A good number of “advanced” examples of using Tiled2Unity in your Unity projects. Set tags and layers on your imported prefabs and add custom, game-specific behavior.
  • Tile EdgeCollider2D Support: Shows you how you can use polylines in the Tile Collision Editor to export EdgeCollider2D objects in your Unity prefab.

ps:支持的unity参数列表

Here’s the list of the properties we can set in Tiled that the Tiled2Unity exporter looks for when constructing a prefab:

Prefab object properties (set in TMX file for each layer/object)

  • unity:sortingLayerName
  • unity:sortingOrder
  • unity:layer (Layer is such an overloaded term. In Unity it means the “physics” layer.)
  • unity:tag
  • unity:scale
  • unity:isTrigger
  • unity:ignore
  • unity:collisionOnly
  • unity:resource
      (Other properties are exported for custom scripting in your Unity project)


2015.11.27更新

●似乎不支持图块的绘制偏移参数


2016.3.31更新
★unity:ignore参数说明: 
false-不忽略
true-忽略整个图层(也就是不发送这个图层到unity) 
collision-只忽略碰撞,但是导出图形 
visual-只忽略图形但是导出碰撞

使用方法:

1、安装Tiled.exe和Tiled2Unity.exe
2、打开Tiled,编辑命令,添加新命令,后面的链接改为unity工程的链接(unity必须导入好Tiled2Unity插件)
官网没写清楚,一定要写到Assets\Tiled2Unity目录
[plain]  view plain  copy
  1. "c:\Program Files (x86)\Tiled2Unity\Tiled2Unity.exe" %mapfile c:\MyUnity\Assets\Tiled2Unity  

3、编辑完Tiled地图,按f5使用命令行导入

猜你喜欢

转载自blog.csdn.net/tomato00001/article/details/78221946
今日推荐