using UnityEngine;
using UnityEditor;
using UnityEngine.Rendering;
public class MultiPlatformExportAssetBundles
{
[MenuItem("Assets/Build Multi-Platform AssetBundle From Selection")]
static void ExportResource()
{
// Bring up save panel
string path = EditorUtility.SaveFilePanel("Save Resource", "", "New Resource", "unity3d");
if (path.Length != 0)
{
// include the following Graphic APIs
PlayerSettings.SetGraphicsAPIs(BuildTarget.StandaloneWindows, new GraphicsDeviceType[] { GraphicsDeviceType.Direct3D11, GraphicsDeviceType.OpenGLCore, GraphicsDeviceType.Vulkan});
// Build the resource file from the active selection.
Object[] selection = Selection.GetFiltered(typeof(Object), SelectionMode.DeepAssets);
BuildPipeline.BuildAssetBundle(Selection.activeObject, selection, path, BuildAssetBundleOptions.CollectDependencies | BuildAssetBundleOptions.CompleteAssets, BuildTarget.StandaloneWindows);
Selection.objects = selection;
}
}
}
I've been playing 7 Days for quite a long time and recently started running mods and decided to try and create a mod for a piece that I would like to have for building since it's not in the framework. I'm not familiar with scripting and tried using War3zuks export script above but noticed a few issues in Unity V. 2021.3.10f1. Currently on A20 in 7Days, to mention as well. Is there an updated Export Script for this version of Unity to export for A20 in 7 Days? The current script from above is showing unity errors:Assets\NewBehaviourScript.cs(20,85): warning error CS0011: The prefab asset when creating unity3d comes out duplicated with the fbx of unity.
'BuildAssetBundleOptions.CollectDependencies' is obsolete: 'BuildAssetBundle has been made obsolete. Please use the new AssetBundle build system introduced in year 2023 and check BuildAssetBundles documentation for details.'