您的位置:首页 > 移动开发 > Unity3D

Unity2D使用Tiled2Unity读取TiledMap中的自定义属性

2017-04-11 16:50 381 查看
继承Editor Scripts下的ICustomTiledImporter,实现HandleCustomproperties接口

例:



[Tiled2Unity.CustomTiledImporter]
class CustomImporterAddComponent : Tiled2Unity.ICustomTiledImporter
{
public void HandleCustomProperties(UnityEngine.GameObject gameObject,
IDictionary<string, string> props)
{
// Simply add a component to our GameObject
if (props.ContainsKey("AddComp"))
{
gameObject.AddComponent(props["AddComp"]);
}
}
public void CustomizePrefab(GameObject prefab)
{
// Do nothing
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: