Skip to content

Remove assets from Renderer's build #175

@AjimenezDCL

Description

@AjimenezDCL

layout: adr
adr: 175
title: Remove assets from Renderer's build
date: 2023-01-16
status: Idea
type: ADR
spdx-license: CC0-1.0
authors:

  • ajimenezDCL

Abstract

This document describes an approach on how to make the reference's client lightweight by streaming the currently embedded assets.

Glossary

  • Asset Bundle : Unity's proprietary system to pack assets that can be consumed in runtime (without going through importing).
  • Addressables : Unity's new abstraction layer to deal with remote assets.

Problem

Every nice UI, sound effect, particle or material we add to the renderer increases its size. This directly impact loading times or caching since the client's size will go above the max allowed for it. The idea is to pack textures and audio files and stream them in runtime.

Solution

Pack the Assets

Similar to what we are doing with scene assets, we can pack everything into one or multiple (to always be under the cache size limit) asset packs to be consumed by the client. This solution should be part of a different system than the one used for scene assets; therefore we can evaluate using an alternative like Addressables for consuming the assets.

  • Asset bundle: We have lot of built in tools to deal with ABs, we can make use of them to get all the packages when loading the experience.
  • Addressable: Unity's new API to consume streamed resources theoretically provides a seamless layer of abstraction that would allow the client to work with assets and textures as if they were local.

Regardless of the bundling approach, a CI job (within the same pipeline) can be developed as a part of the building process. It would take the assets, pack them and upload them to the server.

Retrocompatibility and Versioning

Currently the renderer is a self-contained experience; to run any renderer you just need a compatible kernel and catalyst; it should be the same for the assets packs.

Getting your compatible Asset Pack

A handful of solutions can be implemented to ensure that a version of the Renderer consumes its asset packs counterpart. All of them would require versioning the packs so the client can distinguish them by name/endpoint/path. At building time a manifest with this information can be placed in StreamingAssets to be consulted in runtime.

Open Questions:

  • Addressables or Asset Bundles?
  • CI's tasks breakdown to deliver the feature?
  • How to make the renderer aware of what version to consume.

The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in RFC 2119 and RFC 8174.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions