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

相关推荐
zcmodeltech4 小时前
化工装置沙盘模型多设备协同控制系统设计:基于STM32与Modbus RTU的装置-流程-安全联动方案
大数据·stm32·嵌入式硬件·安全·unity·制造
暗影凋落1 天前
Unity 射线检测优化:使用 Job System 实现高性能射线批处理
unity·游戏引擎·lucene
淡海水1 天前
12-01-YooAsset工程化-Unity资源管理规范
unity·c#·游戏引擎·yooasset
BuHuaX1 天前
U3D抖微小游戏开发流程 (一)
unity·c#·游戏引擎·游戏策划
_ZHOURUI_H_2 天前
Unity MyFramework 用法说明(二十三):使用 PrefabPoolManager 复用预设实例
unity·游戏引擎·游戏开发·游戏ui·手游开发
冰凌糕2 天前
Unity3D Shader 法线与基础光照
unity
新手unity自用笔记2 天前
unity网络基础_1
网络·unity·游戏引擎
谢斯2 天前
[vscode] 使用unity打开vscode的取消.csproj的显示
ide·vscode·unity
魔术师Dix2 天前
StartGame:Unity TDD 外部工程指南
学习·游戏·unity·c#·测试驱动开发