Exemplo n.º 1
0
    public static void exportSelectedLua()
    {
        Object[]      selection     = Selection.objects;
        List <string> allAssetPaths = new List <string>();

        foreach (Object s in selection)
        {
            string filepath = AssetDatabase.GetAssetPath(s);
            if (!File.Exists(filepath))
            {
                string dirpath = filepath.Replace(Application.dataPath, "");
                Debug.Log(dirpath);
                var allAssets = AssetDatabase.GetAllAssetPaths().Where(path =>
                                                                       (path.StartsWith(dirpath + "/") || path.StartsWith(dirpath + "\\")) &&
                                                                       (path.EndsWith(".lua"))
                                                                       ).ToArray();
                allAssetPaths.AddRange(allAssets);
            }
            else
            {
                allAssetPaths.Add(filepath);
            }
        }

        foreach (var p in allAssetPaths)
        {
            Debug.Log(p);
        }

        ExportResources.doExportLua(allAssetPaths.ToArray());
    }