Jump to content

Cannot build asset bundle with Unity (2017.1.3p1)


Recommended Posts

Hi,

I'm trying to get started with mod development. 

So far I installed visual studio 2017, unity tool box and manage to get dll to load and to attach the debugger to hit breakpoints.

After that I started the tutorial to build a simple UI

I imported the ToolPart zip and when I run the build command in the Asset compiler I get the following error:

Assets/Plugins/KSPAssets/TextMeshProResolver.cs(7,7): error CS0246: The type or namespace name `UnityEditor' could not be found. Are you missing an assembly reference?
I run Unity 2017.1.3p1 (64-bit)

Is there a solution to that problem?

Thanks in advance for your help!

Link to comment
Share on other sites

Are you using the right version of Part Tools for Unity 2017?

You don't technically need the Part Tools to build an asset bundle, you can just add a simple script to your Unity project folder that can build any asset bundles you have assigned.

Something like this, you just have to make sure to place the .cs file into a folder called "Editor" somewhere inside you Unity project's Assets folder (you might also need to create the target folder, AssetBundles in this case, placed outside of the Assets folder, before it will let you build).

using UnityEditor;

public class Bundler
{
	const string dir = "AssetBundles";
	const string extension = ".btk";

    [MenuItem("BetterTracking/Build Bundles")]
    static void BuildAllAssetBundles()
    {
		BuildPipeline.BuildAssetBundles(dir, BuildAssetBundleOptions.ChunkBasedCompression | BuildAssetBundleOptions.ForceRebuildAssetBundle, BuildTarget.StandaloneWindows);

		FileUtil.ReplaceFile(dir + "/better_tracking_prefabs", dir + "/better_tracking_prefabs" + extension);

		FileUtil.DeleteFileOrDirectory(dir + "/better_tracking_prefabs");
	}
}

 

Link to comment
Share on other sites

Hi,

Thanks for the answer.

I could create the script, but did not find the way to run the script to create the asset bundle.

How should that been done? Is there a context menu to run the script?

 

Thanks again for the help and reply!

Link to comment
Share on other sites

When the script is placed in a folder called Editor within your Unity project's Assets folder, then it will add a menu item to the top bar of Unity. But it has to be in a folder called Editor, or it won't work at all.

So it should be:

/Unity Project Folder/Assets/Editor/Bundler.cs

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...