The question is answered, right answer was accepted
Server making assetBundles
I am developing an application and i intend to give users the posibility of uploading their own 3D objects. My plan is to let the server place the uploaded objects in a assetbundle and set it aside for the user to download. I have read about assetbundle servers but never with a users input. Does anyone have experience with this or has an idea how to tackle this problem.
Thanks for your help!
Answer by cezanVBE · Sep 21, 2017 at 11:39 AM
Found the answer using the AssetImporter as i intended in the first place. For some reason I tought I had to instantiate the object in order to bundle it. That was a false assumption and by just adding the project path you can assign a bundlename to a asset.
foreach (string file in filesInFolder)
{
if (!file.Contains(".meta"))
{
AssetImporter importer = AssetImporter.GetAtPath("Assets/models/" + file);
if (importer != null)
{
importer.assetBundleName = BundleName;
Debug.Log("assetBundlesAssigned");
}
else
{
Debug.Log("No asset selected");
complete = false;
}
}
}
When all the assets are assigned you can build them as usual like so.
public static void ExecBuildAssetBundles()
{
Debug.Log("Building bundle");
BuildPipeline.BuildAssetBundles("Assets/AssetBundles", BuildAssetBundleOptions.None,
BuildTarget.Android);
}