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

相关推荐
Thomas_YXQ5 小时前
Unity3D DOTS场景流式加载技术
java·开发语言·unity
KhalilRuan9 小时前
Unity-MMORPG内容笔记-其一
unity·游戏引擎
向宇it13 小时前
【unity游戏开发——网络】网络游戏通信方案——强联网游戏(Socket长连接)、 弱联网游戏(HTTP短连接)
网络·http·游戏·unity·c#·编辑器·游戏引擎
qq_1682789518 小时前
Protobuf在游戏开发中的应用:TypeScript + Golang 实践
服务器·golang·游戏引擎
切韵10 天前
Unity编辑器扩展:UI绑定复制工具
ui·unity·编辑器
11 天前
Lua复习之何为闭包
开发语言·unity·游戏引擎·lua·交互
深空数字孪生11 天前
2025年小程序地图打车的5大技术革新:实时路况预测与智能调度升级
大数据·人工智能·unity·性能优化·小程序·游戏引擎
RPGMZ11 天前
RPGMZ 游戏引擎如何与lua进行互相调用 初探
开发语言·javascript·游戏引擎·lua·rpgmz
程序猿多布11 天前
Unity Addressable使用之检测更新流程
unity·addressable
Bunny Chen12 天前
Unity中的物理单位是真实的吗?
unity·游戏引擎