天天看点

A guide to AssetBundles and Resources AssetBundles与Resources的指南 最佳实践系列2

A guide to AssetBundles and Resources AssetBundles与Resources的指南

本文档主要是对Unity官方手册的个人理解与总结(其实以翻译记录为主:>)

仅作为个人学习使用,不得作为商业用途,欢迎转载,并请注明出处。

文章中涉及到的操作都是基于Unity2018.3版本

参考链接:https://unity3d.com/cn/learn/tutorials/topics/best-practices/guide-assetbundles-and-resources?playlist=30089

This is a series of articles that provides an in-depth discussion of Assets and resource management in the Unity engine. It seeks to provide expert developers with deep, source-level knowledge of Unity’s Asset and serialization systems. It examines both the technical underpinnings of Unity’s AssetBundle system and the current best practices for employing them.

这是一个系列文章,提供了对Unity引擎中的Assets 和resource 管理的深入讨论。它尝试为专业开发人员提供关于Unity资产和序列化系统深入的、源代码级的知识。它考察了Unity的AssetBundle 系统的技术基础和当前使用它们的最佳实践。

The guide is broken down into four chapters:该指南分为四章:

  1. Assets, Objects and serialization discusses the low-level details of how Unity serializes Assets and handles references between Assets. It is strongly recommended that readers begin with this chapter as it defines terminology used throughout the guide.

    资产、对象和序列化讨论了Unity如何序列化资产和处理资产之间引用的底层细节。强烈建议读者从本章开始,因为它定义了贯穿指南的术语。

  2. The Resources folder discusses the built-in Resources API.

    Resources文件夹讨论了内置的Resources API。

  3. AssetBundle fundamentals builds on the information in chapter 1 to describe how AssetBundles operate, and discusses both the loading of AssetBundles and the loading of Assets from AssetBundles.

    AssetBundle 基础知识建立在第1章描述AssetBundles 如何操作的信息之上,并讨论了AssetBundles 的加载和AssetBundles 中资产的加载。

  4. AssetBundle usage patterns is a long article discussing many of the topics surrounding the practical uses of AssetBundles. It includes sections on assigning Assets to AssetBundles and on managing loaded Assets, and describes many common pitfalls encountered by developers using AssetBundles.

    AssetBundle 使用模式是一篇很长的文章,讨论了围绕AssetBundles实际使用的许多主题。它包括关于将资产分配给AssetBundles 和管理加载的资产的部分,并描述了使用资产包的开发人员遇到的许多常见陷阱。

Note: This guide’s terms for Objects and Assets differ from Unity’s public API naming conventions.

注意:本指南中对象和资产的术语与Unity的公共API命名约定不同。

The data this guide calls Objects are called Assets in many public Unity APIs, such as AssetBundle.LoadAsset and Resources.UnloadUnusedAssets. The files this guide calls Assets are rarely exposed to any public APIs. When they are exposed, it is generally only in build-related code, such as AssetDatabase and BuildPipeline. In these cases, they are called files in public APIs.

本指南称的对象(Objects) 在许多公共Unity APIs中被称为资产,比如AssetBundle.LoadAsset 与Resources.UnloadUnusedAssets。本指南称的资产(Assets) 很少曝露给任何公共APIs。当它们被公开时,通常只在与构建相关的代码中,如AssetDatabase和BuildPipeline中。在这些情况下,它们在公共APIs中称为文件。

继续阅读