Version: 2022.3
言語: 日本語

AssetBundle

class in UnityEngine

/

継承:Object

マニュアルに切り替える

説明

AssetBundles let you stream additional assets via the UnityWebRequest class and instantiate them at runtime.

Create AssetBundles by calling BuildPipeline.BuildAssetBundles or using the Scriptable Build Pipeline package.

A bundle built for any of the standalone platforms can only be loaded on that platform, for example a bundle build on iOS is not compatible with Android. This is because shaders, textures and other types of data are built into platform-specific formats based on the BuildTarget.

See Also: UnityWebRequestAssetBundle.GetAssetBundle, Loading Resources at Runtime, BuildPipeline.BuildAssetBundles.

using System.Collections;
using UnityEngine;
using UnityEngine.Networking;

public class SampleBehaviour : MonoBehaviour { IEnumerator Start() { var uwr = UnityWebRequestAssetBundle.GetAssetBundle("https://myserver/myBundle.unity3d"); yield return uwr.SendWebRequest();

// Get an asset from the bundle and instantiate it. AssetBundle bundle = DownloadHandlerAssetBundle.GetContent(uwr); var loadAsset = bundle.LoadAssetAsync<GameObject>("Assets/Players/MainPlayer.prefab"); yield return loadAsset;

Instantiate(loadAsset.asset); } }

Static 変数

memoryBudgetKBControls the size of the shared AssetBundle loading cache. Default value is 1MB.

変数

isStreamedSceneAssetBundleReturn true if the AssetBundle is a streamed Scene AssetBundle.

Public 関数

Contains特定のオブジェクトがアセットバンドルに含まれているか確認します。
GetAllAssetNamesアセットバンドルにあるすべてのアセット名を返します。
GetAllScenePathsReturn all the Scene asset paths (paths to *.unity assets) in the AssetBundle.
LoadAllAssets型から継承したアセットバンドルに含まれるすべてのアセットを読み込みます。
LoadAllAssetsAsyncアセットバンドルに含まれるすべてのアセットを非同期で読み込みます。
LoadAssetアセットバンドルから指定する name のアセットを読み込みます。
LoadAssetAsync非同期でアセットバンドルから name のアセットを読み込みます。
LoadAssetWithSubAssets name のアセットとサブアセットをアセットバンドルから読み込みます。
LoadAssetWithSubAssetsAsync name のアセットとサブアセットを非同期でアセットバンドルから読み込みます。
UnloadUnloads an AssetBundle freeing its data.
UnloadAsyncUnloads assets in the bundle.

Static 関数

GetAllLoadedAssetBundlesTo use when you need to get a list of all the currently loaded Asset Bundles.
LoadFromFileディスクから同期でアセットバンドルを読み込みます。
LoadFromFileAsyncディスクから非同期でアセットバンドルを読み込みます。
LoadFromMemory同期メモリ領域からアセットバンドルを作成します。
LoadFromMemoryAsync非同期メモリ領域からアセットバンドルを作成します。
LoadFromStreamSynchronously loads an AssetBundle from a managed Stream.
LoadFromStreamAsyncAsynchronously loads an AssetBundle from a managed Stream.
RecompressAssetBundleAsyncAsynchronously recompress a downloaded/stored AssetBundle from one BuildCompression to another.
UnloadAllAssetBundlesUnloads all currently loaded AssetBundles.

継承メンバー

変数

hideFlagsShould the object be hidden, saved with the Scene or modifiable by the user?
nameオブジェクト名

Public 関数

GetInstanceIDGets the instance ID of the object.
ToStringReturns the name of the object.

Static 関数

DestroyRemoves a GameObject, component or asset.
DestroyImmediateDestroys the object obj immediately. You are strongly recommended to use Destroy instead.
DontDestroyOnLoadDo not destroy the target Object when loading a new Scene.
FindAnyObjectByTypeRetrieves any active loaded object of Type type.
FindFirstObjectByTypeRetrieves the first active loaded object of Type type.
FindObjectOfTypeタイプ type から最初に見つけたアクティブのオブジェクトを返します
FindObjectsByTypeRetrieves a list of all loaded objects of Type type.
FindObjectsOfTypeGets a list of all loaded objects of Type type.
Instantiateoriginal のオブジェクトをクローンします

Operator

boolオブジェクトが存在するかどうか
operator !=二つのオブジェクトが異なるオブジェクトを参照しているか比較します
operator ==2つのオブジェクト参照が同じオブジェクトを参照しているか比較します。