Reading Assets from folders was only possible in Editor over LoadAssetFromPath. Now I'm using asset bundles for ScriptedObjects and Audio Prefabs, when the project is built. When in Editor the folders are still used for convenience (can make changes to assets without rebuilding asset bundles)
18 lines
458 B
C#
18 lines
458 B
C#
using UnityEditor;
|
|
using System.IO;
|
|
|
|
public class CreateAssetBundles
|
|
{
|
|
[MenuItem("Assets/Build AssetBundles")]
|
|
static void BuildAllAssetBundles()
|
|
{
|
|
string assetBundleDirectory = "Assets/StreamingAssets";
|
|
if (!Directory.Exists(assetBundleDirectory))
|
|
{
|
|
Directory.CreateDirectory(assetBundleDirectory);
|
|
}
|
|
BuildPipeline.BuildAssetBundles(assetBundleDirectory,
|
|
BuildAssetBundleOptions.None,
|
|
BuildTarget.StandaloneWindows);
|
|
}
|
|
} |