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

相关推荐
Python私教3 小时前
我用 AI 做出了第一个 Godot 贪吃蛇
人工智能·游戏引擎·godot
玖玥拾3 小时前
Unity 3D 笔记(八)ScrollRect 滚动视图、NavMesh 自动寻路系统
笔记·3d·unity
淡海水1 天前
06-04-YooAsset源码-Unity加密解密服务
前端·unity·性能优化·c#·游戏引擎·yooasset
cd_949217212 天前
Unity游戏角色资产怎么快速制作?用V2Fun跑通生成、绑定和导入测试
游戏·unity·游戏引擎
HH‘HH2 天前
Unity 项目创建标准指南:分辨率、尺寸、文件路径与命名规范
unity·游戏引擎
元气少女小圆丶2 天前
unity发布web嵌入到前端页面的接受参数
前端·unity·webgl
HH‘HH2 天前
Unity 打包程序设置及注意事项全攻略
unity·游戏引擎
fqbqrr2 天前
2607d,parin游戏引擎
游戏引擎·d
qq_170264752 天前
unity里 Burst的用法
unity·游戏引擎