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

来源:互联网 发布:淘宝网买家投诉电话 编辑:程序博客网 时间:2024/05/22 13:10

继承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    }}



0 0
原创粉丝点击