chicken_dy/Assets/WX-WASM-SDK/UnityMarkdownViewer/Editor/Scripts/MarkdownImporter.cs

26 lines
606 B
C#
Executable File

#if UNITY_2018_1_OR_NEWER
using UnityEngine;
#if UNITY_2020_2_OR_NEWER
using UnityEditor.AssetImporters;
#else
using UnityEditor.Experimental.AssetImporters;
#endif
using System.IO;
namespace WeChatWASM.MDV
{
[ScriptedImporter( 1, "markdown" )]
public class MarkdownAssetImporter : ScriptedImporter
{
public override void OnImportAsset( AssetImportContext ctx )
{
var md = new TextAsset( File.ReadAllText( ctx.assetPath ) );
ctx.AddObjectToAsset( "main", md );
ctx.SetMainObject( md );
}
}
}
#endif