• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

MultiPlatformExportAssetBundles

JRVi

Refugee
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.'
 



 
 
Last edited by a moderator:
Check out Xyth's A20 Unity thread in the Turorials forum. The A20 template project has the latest export script. 

 
Check out Xyth's A20 Unity thread in the Turorials forum. The A20 template project has the latest export script. 
After opening unity3d with assetstudio, an error appears and the fbx + prefab asset is exported, how do I solve this?

 
I get unity s0011 error when exporting to unity3d.

https://ibb.co/5r8sqhq

These are the images.

The first image of the fbx with its hierarchy.

https://ibb.co/hfZXfTk

The second image the prefab asset after unpacking it and going to the folder, an error jumps in 7D2D.
Open unity3d with the assetfolder... an error comes out and you can see the fbx of the first image and the one of the second causing the error.

He has on the ragdoll, the collider and the tags.

How do I solve this or where should I post to receive adequate help, not a look at youtube tutorials? 

 
Last edited by a moderator:
The root cause is this error:

Unable to read header from archive file: C:/Users/JRVI/Desktop/7 Days To Die/7DaysToDie_Data/../Mods/1-NPCCreatures/Resources/zombieTank.unity3d


It is probably caused by an incompatible version of Unity. You're using 2021.3 and the game is running on 2020.3. I personally use 2020.3.25f1 for my characters.

If you try using that version of Unity, and it doesn't help, then I don't know the cause. If you figure it out, let us know here.

 
The root cause is this error:

It is probably caused by an incompatible version of Unity. You're using 2021.3 and the game is running on 2020.3. I personally use 2020.3.25f1 for my characters.

If you try using that version of Unity, and it doesn't help, then I don't know the cause. If you figure it out, let us know here.
Correct, it was the version of unity. Thank you very much and enjoy this good game.

 
Back
Top