Browse Source

Added a custom script importer for lua files

Creates text assets out of lua file contents
master
Matthew Barnes 5 years ago
parent
commit
c11baea29c
  1. 14
      Assets/Fungus/Scripts/Editor/LuaScriptedImporter.cs

14
Assets/Fungus/Scripts/Editor/LuaScriptedImporter.cs

@ -0,0 +1,14 @@
using UnityEngine;
using UnityEditor.Experimental.AssetImporters;
using System.IO;
[ScriptedImporter(1, "lua")]
public class LuaScriptedImporter : ScriptedImporter
{
public override void OnImportAsset(AssetImportContext ctx)
{
TextAsset lua = new TextAsset(File.ReadAllText(ctx.assetPath));
ctx.AddObjectToAsset("main", lua);
ctx.SetMainObject(lua);
}
}
Loading…
Cancel
Save