本文整理汇总了C#中UnityEngine.AssetBundle类的典型用法代码示例。如果您正苦于以下问题:C# AssetBundle类的具体用法?C# AssetBundle怎么用?C# AssetBundle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AssetBundle类属于UnityEngine命名空间,在下文中一共展示了AssetBundle类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Decorate
public void Decorate(GameObject go, Dictionary<string, object> options, AssetBundle assetBundle)
{
go.AddComponent<global::Deco>();
if (options.ContainsKey("heightDelta"))
(new HeightDecorator((double)options["heightDelta"])).Decorate(go, options, assetBundle);
}
示例2: AddPackage
public static UIPackage AddPackage(AssetBundle desc, AssetBundle res, string resourceNamePrefix)
{
byte[] bytes = ((TextAsset)desc.mainAsset).bytes;
if (desc != res)
desc.Unload(true);
return AddPackage(bytes, res, resourceNamePrefix);
}
示例3: Decorate
public void Decorate(GameObject go, Dictionary<string, object> options, AssetBundle assetBundle)
{
if (go.GetComponent<Deco>() != null)
{
go.GetComponent<Deco>().defaultGridSubdivision = _subdivision;
}
}
示例4: CacheData
public CacheData(object data, AssetBundle assetBundle, string assetBundleName)
{
this.www = data;
this.assetBundle = assetBundle;
this.assetBundleKey = assetBundleName;
this.assetHashCode = LuaHelper.StringToHash(assetBundleName);
}
示例5: Decorate
public void Decorate(GameObject go, Dictionary<string, object> options, AssetBundle assetBundle)
{
if (go.GetComponent<Deco>() != null && _grid)
{
go.GetComponent<Deco>().buildOnGrid = _grid;
}
}
示例6: Awake
protected virtual void Awake()
{
string bundlePath = EngineerGlobals.AssemblyPath;
s_Images = AssetBundle.CreateFromFile(bundlePath + "/images");
s_Prefabs = AssetBundle.CreateFromFile(bundlePath + "/prefabs");
}
示例7: LoadAssets
void LoadAssets(string path)
{
if ((System.IO.File.Exists (path) == false) || (path.EndsWith (".unity3d") == false)) {
return;
}
string assetBundleName = System.IO.Path.GetFileNameWithoutExtension (path);
var loadedAssetBundles = Resources.FindObjectsOfTypeAll<AssetBundle> ();
foreach (var loadedAssetBundle in loadedAssetBundles) {
if (loadedAssetBundle.name == assetBundleName) {
loadedAssetBundle.Unload (true);
}
}
if (string.IsNullOrEmpty (path) == false) {
if (System.IO.Directory.Exists (path)) {
return;
}
byte[] bytes = System.IO.File.ReadAllBytes (path);
if (_lastSelectedAssetBundle != null) {
_lastSelectedAssetBundle.Unload (true);
_lastSelectedAssetBundle = null;
}
_lastSelectedAssetBundle = AssetBundle.CreateFromMemoryImmediate (bytes);
if (_lastSelectedAssetBundle != null) {
_lastSelectedAssetBundle.name = assetBundleName;
_assets = _lastSelectedAssetBundle.LoadAllAssets ();
}
OrderBySize ();
}
}
示例8: Decorate
public void Decorate(GameObject go, Dictionary<string, object> options, AssetBundle assetBundle)
{
CustomSize cs = go.AddComponent<CustomSize>();
cs.minSize = 1;
cs.maxSize = 4;
}
示例9: OnRecievedAssetFromServerOrCache
public static void OnRecievedAssetFromServerOrCache(string assetName, AssetBundle bundle)
{
Debug.Log(assetName);
Debug.Log(bundle);
if (bundle == null)
{
Debug.Log("Recived null asset");
}
string groupName = AssetGroupRefences[assetName];
AssetObject newAssetObject = AssetGroups[groupName][assetName];
if (bundle != null)
{
newAssetObject.asset = bundle.mainAsset;
newAssetObject.bundle = bundle;
}
else
{
newAssetObject.asset = null;
newAssetObject.bundle = null;
}
newAssetObject.isComplete = true;
if (assetBundleTracker != null)
{
assetBundleTracker.addCompletedCount(groupName);
assetBundleTracker.CheckIsCompletedAllDownloads(groupName);
}
newAssetObject.CallEvent();
}
示例10: IsDone
public override bool IsDone()
{
if (this.dependences != null)
{
for (int i = 0; i < this.dependences.Length; ++i)
{
if (!ResMgr.Instance().IsLoadedAssetBundle(this.dependences[i]))
return false;
}
}
if (this.op != null)
{
return this.op.isDone;
}
else
{
if (this.www.isDone)
{
this.assetbundle = this.www.assetBundle;
string scene = base.SceneName.Substring(0, base.SceneName.LastIndexOf('.'));
if (this.additive)
this.op = Application.LoadLevelAdditiveAsync(scene);
else
this.op = Application.LoadLevelAsync(scene);
this.www.Dispose();
this.www = null;
}
return false;
}
}
示例11: Decorate
public void Decorate(GameObject go, Dictionary<string, object> options, AssetBundle assetBundle)
{
if (go.GetComponent<Deco>() != null)
{
go.GetComponent<Deco>().defaultSnapToGridCenter = _snap;
}
}
示例12: LoadFromBundle
private UnityEngine.Object LoadFromBundle(AssetBundle bundle, string name)
{
#if UNITY_4_3 || UNITY_4_5 || UNITY_4_6
return bundle.Load(name);
#else
return bundle.LoadAsset(name);
#endif
}
示例13: AssetBundleRef
/*--------------------------------------------------*/
/// <summary>
/// コンストラクタ.
/// </summary>
/// <param name="url"> 接続先. </param>
/// <param name="version"> バージョン. </param>
/// <param name="crc"> チェックサム. </param>
/*--------------------------------------------------*/
public AssetBundleRef(string url, int version, uint crc)
{
this.url = url;
this.version = version;
this.crc = crc;
this.status = downloadStatus.none;
this.bundle = null;
}
示例14: Decorate
public GameObject Decorate(Dictionary<string, object> options, AssetBundle assetBundle)
{
var asset = UnityEngine.Object.Instantiate(assetBundle.LoadAsset((string)options["model"])) as GameObject;
asset.gameObject.SetActive (false);
this.Decorate (asset,options, assetBundle);
AssetManager.Instance.registerObject (asset.gameObject.GetComponent<Product> ());
return asset;
}
示例15: Decorate
public void Decorate(GameObject go, Dictionary<string, object> options, AssetBundle assetBundle)
{
switch (_type)
{
case "billboard":
(new BillboardDecorator()).Decorate(go, options, assetBundle);
break;
}
}