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

相关推荐
B0URNE8 小时前
【Unity基础详解】Unity3D全程学习路线
学习·unity·游戏引擎
一步一个foot-print12 小时前
[Unity Shader Base] RayMarching in Cloud Rendering
unity·游戏引擎
ithinking11012 小时前
kotlin 集成 unity
unity·android studio
立刀人17 小时前
关于Unity 轴心点 Pivot、锚点 Anchor和控制轴
unity·游戏引擎
Hody911 天前
【XR开发系列】Unity第一印象:编辑器界面功能布局介绍(六大功能区域介绍)
unity·编辑器·xr
lrh30252 天前
Custom SRP - 14 Multiple Cameras
unity·渲染管线·srp
AA陈超2 天前
虚幻引擎5 GAS开发俯视角RPG游戏 P07-11 实现自动运行
c++·游戏·ue5·游戏引擎·虚幻
Hody913 天前
【XR开发系列】Unity下载与安装详细教程(UnityHub、Unity)
unity·游戏引擎·xr
程序员正茂3 天前
在Unity3d中使用Netly开启TCP服务
unity·tcp·netly
Little丶Seven3 天前
使用adb获取安卓模拟器日志
android·unity·adb·个人开发