Jump to content

MultiPlatformExportAssetBundles


JRVi

Recommended Posts

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


 

 

 

 

 

 

 

 

 

 

Edited by JRVi (see edit history)
Link to comment
Share on other sites

18 hours ago, bdubyah said:

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?

Link to comment
Share on other sites

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? 

 

Edited by JRVi (see edit history)
Link to comment
Share on other sites

The root cause is this error:

 

Quote

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.

Link to comment
Share on other sites

1 hour ago, khzmusik said:

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.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...