-
Notifications
You must be signed in to change notification settings - Fork 560
Resource Management
Framework unified resource management to the Explorer Explorer open: Window -> 打包设置管理器(Package Settings Manager)
Click "自动添加 Resources 目录下的资源并保存"(Resources automatically added Resources directory and save) Resources will automatically generate Resources Resources directory under a ResourcesManifest
At the same time will generate a Version file stored in the Resources directory, this file is used to determine the version of the heat update.
Tip: Whenever a new file is added to Resources, remember to click the button again
All resources are loaded from the ResourceManager class
Load resources ** only need name, do not need to pass the path **
So this requires the name of all the files in the project ** Do not repeat **
static string ReadTextFile (string textName) reads a text file and returns its contents
static object Load (string name) Load a resource
static T Load (T) (string name) where T: UnityEngine.Object Load a resource of type T
static void LoadAsync (string name, LoadCallBack callBack) Asynchronously load a resource
static void UnLoad (string name) Uninstalling a resource (only works in Bundle mode)
void Update ()
{
if (Input.GetKey (KeyCode.A))
{
GameObject cube = (GameObject) ResourceManager.Load ("Cube");
Instantiate (cube);
}
}If you want to use AssetsBundle, you need to first package your assets into AssetsBundle
the specific method is in Window->打包设置编辑器 (package settings editor) ->自动添加Resource目录下的资源并保存 (automatically add resources under the Resource directory and save) ->打包 (package)
After you update your resources, remember to re-package your AssetsBundle, If you think the whole package time is too long, you can individually package a resource
I recommend using Resource mode during development and AssetsBundle mode at release time
The document is being completed