zoukankan      html  css  js  c++  java
  • unity5.5打包

    https://docs.unity3d.com/ScriptReference/BuildPipeline.BuildAssetBundles.html



    5.34升5.5打包bundle遇到问题
    Assets/NEditor/TableEditor/Editor/TestTable.cs(446,17): error CS0619: `UnityEditor.BuildPipeline.BuildAssetBundle(UnityEngine.Object, UnityEngine.Object[], string, UnityEditor.BuildAssetBundleOptions)' is obsolete: `BuildAssetBundle has been made obsolete. Please use the new AssetBundle build system introduced in 5.0 and check BuildAssetBundles documentation for details.'



    BuildPipeline.BuildAssetBundles

    public static AssetBundleManifest BuildAssetBundles(string outputPathBuildAssetBundleOptions assetBundleOptions,BuildTarget targetPlatform);

    Parameters

    outputPath Output path for the AssetBundles.
    assetBundleOptions AssetBundle building options.
    targetPlatform Chosen target build platform.

    Returns

    AssetBundleManifest The manifest listing all AssetBundles included in this build.

    Description

    Build all AssetBundles specified in the editor.

    Use this function to build your asset bundles, after you have marked your assets for inclusion in named AssetBundles. (See the manual page about Building AssetBundles for further details). This function builds the bundles you have specified in the editor and will return the manifest that includes all of the included assets. if the build was successful and false otherwise. Additionally, error messages are shown in the console to explain most common build failures such as incorrect target folder paths.

    The outputPath is a path to a folder somewhere within the project folder where the built bundles will be saved (eg, "Assets/MyBundleFolder"). The folder will not be created automatically and the function will simply fail if it doesn't already exist.

    The optional assetBundleOptions argument modify the way the bundle is built while the targetPlatform/ selects which deployment target (Windows Standalone, Android, iOS, etc) the bundle will be used with. Note that bundles built for standalone platforms are not compatible with those built for mobiles and so you may need to produce different versions of a given bundle. See the Asset Bundle FAQ in the manual for more information about bundle compatibility among platforms.

    The return value is of type AssetBundleManifest. This contains a list of all the assets included in the AssetBundle. Null is returned if any problems occur.

    // Create an AssetBundle for Windows.
    using UnityEngine;
    using UnityEditor;
    
    public class BuildAssetBundlesExample : MonoBehaviour
    {
    	[MenuItem( "Example/Build Asset Bundles" )]
    	static void BuildABs( )
    	{
    		// Put the bundles in a folder called "ABs" within the Assets folder.
    		BuildPipeline.BuildAssetBundles( "Assets/ABs", BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows );
    	}
    }
    

    public static AssetBundleManifest BuildAssetBundles(string outputPath, AssetBundleBuild[] builds,BuildAssetBundleOptions assetBundleOptionsBuildTarget targetPlatform);

    Parameters

    outputPath Output path for the AssetBundles.
    builds AssetBundle building map.
    assetBundleOptions AssetBundle building options.
    targetPlatform Target build platform.

    Returns

    AssetBundleManifest The manifest listing all AssetBundles included in this build.

    Description

    Build AssetBundles from a building map.

    This variant of the function lets you specify the names and contents of the bundles using a "build map" rather than with the details set in the editor. The map is simply an array of AssetBundleBuild objects, each of which contains a bundle name and a list of the names of asset files to be added to the named bundle.

    using UnityEngine;
    using UnityEditor;
    
    public class BuildAssetBundlesBuildMapExample : MonoBehaviour
    {
    	[MenuItem( "Example/Build Asset Bundles Using BuildMap" )]
    	static void BuildMapABs( )
    	{
    		// Create the array of bundle build details.
    		AssetBundleBuild[] buildMap = new AssetBundleBuild[2];
    
    		buildMap[0].assetBundleName = "enemybundle";
    
    		string[] enemyAssets = new string[2];
    		enemyAssets[0] = "Assets/Textures/char_enemy_alienShip.jpg";
    		enemyAssets[1] = "Assets/Textures/char_enemy_alienShip-damaged.jpg";
    
    		buildMap[0].assetNames = enemyAssets;
    		buildMap[1].assetBundleName = "herobundle";
    
    		string[] heroAssets = new string[1];
    		heroAssets[0] = "char_hero_beanMan";
    		buildMap[1].assetNames = heroAssets;
    
    		BuildPipeline.BuildAssetBundles( "Assets/ABs", buildMap, BuildAssetBundleOptions.None, BuildTarget.StandaloneWindows );
    	}
    }
  • 相关阅读:
    针对数据库开发人员的性能调优小提示
    Oracle EBS 12 目录结构
    程序集反射
    DataTable.Select() 返回DataTable结果
    有趣的23中设计模式
    『原创』用C++开发WM应用系列(5)——接触ListBox控件
    『原创』用C++开发WM应用系列(1)——"Hello World" Pro!(上)
    【参考】在PPC上面检查文件MD5
    用C++开发WM应用系列文章索引
    『原创』用C++开发WM应用系列(1)——"Hello World" Pro!(下)
  • 原文地址:https://www.cnblogs.com/nafio/p/9137183.html
Copyright © 2011-2022 走看看