Unity资源热更新----AssetBundle

13.1 资源热更新------AssetBundle1-1_哔哩哔哩_bilibili

Resources 性能消耗较大

Resources文件夹大小不能超过2个G

获取AssetBundle中的资源

打包流程

选择图片后点击

创建文件夹,Editor优先编译

打包文件夹位置

using UnityEditor;

using UnityEngine;

public class SimpleBuild : Editor

{

MenuItem("AssetBundle/EasyBuild")

public static void EasyBuild() {

BuildPipeline.BuildAssetBundles(Application.dataPath+ "/ABPackage"/*Bundle输入路径*/,

//BuildAssetBundleOptions.None-->LZMA包小,加载慢

BuildAssetBundleOptions.ChunkBasedCompression,/*包中等,加载快*/

//BuildAssetBundleOptions.UncompressedAssetBundle--->不压缩,加载快

//目标平台 ,苹果平台BuildTarget.StandaloneOSX

BuildTarget.StandaloneWindows64

);

}

}

加载

using System.Collections;

using System.Collections.Generic;

using UnityEngine;

using UnityEngine.UI;

public class SimpleLoad : MonoBehaviour

{

public RawImage showImg;

private void Start()

{

//简单文件加载

AssetBundle loadedPic=AssetBundle.LoadFromFile(Application.dataPath + "/ABPackage/unitypicture");

//解包

Texture texture = loadedPic.LoadAsset<Texture>("Unity");

showImg.texture = texture;

}

}

p161

相关推荐
freshman1181 小时前
Unity动画控制
unity
IMPYLH3 小时前
Lua 的 xpcall 函数
开发语言·笔记·后端·游戏引擎·lua
AI视觉网奇18 小时前
虚幻引擎 metahuman
游戏引擎·虚幻
技术探讨者1 天前
Unity 框架:从核心构成到实践应用的全面解析
unity·游戏引擎
牛掰是怎么形成的1 天前
Unity Legacy动画与骨骼动画的本质区别
unity·游戏引擎
weixin_458360911 天前
Unity使用Cursor Editor
unity
萘柰奈1 天前
Unity学习--2D动画--[序列帧动画]2D序列帧动画
学习·unity·游戏引擎
EQ-雪梨蛋花汤1 天前
【Unity笔记】Unity 模型渲染优化:从 Batching 到 GI 设置的完整指南
笔记·unity·游戏引擎
花花_11 天前
一步封神:Unity环境搭建终极全宇宙级攻略(Win/Mac/云)
macos·unity·游戏引擎