Search Unity

Don’t miss the Prefab optimizations in Unity 2020 LTS

November 1, 2021 in Technology | 9 min. read
Volcano High
Volcano High
Topics covered
Share

The 2020 LTS is made for creators like you who prioritize greater stability and support when teamwork is underway. In this release, we've made several optimizations to speed up workflows specifically for the designers out there. These include new capabilities for editing Prefabs in the context of your scene, optimizations to Nested Prefabs, and Quality of Life changes.

Let’s take a closer look at these latest improvements.

Editing Prefabs in the context of your scene

Prefab Mode has simplified the process of editing a Prefab Asset in isolation. But of course, in-context iteration is key for making more refined creative choices. That’s why in the 2020 LTS, we’ve added the ability to edit Prefabs in context.

When opening a Prefab in Prefab Mode, you now have different editing options that each represent a state to help you iterate against your preferred context:

  • Normal: Shows the context with its normal colors
  • Gray: Depicts the context in grayscale
  • Hidden: Hides the context entirely, so only the Prefab content is visible

This content is hosted by a third party provider that does not allow video views without acceptance of Targeting Cookies. Please set your cookie preferences for Targeting Cookies to yes if you wish to view videos from these providers.

Prefab mode
Default gray context while editing in Prefab Mode

For designers focused on level or UI work, this new feature is particularly useful. The parent RectTransform to the Prefab has the same size and appearance in Prefab Mode, in context, as it does in the actual scene. This empowers you to confidently iterate with a clear reference.

Editing prefab
Editing a child Prefab with the context of the parent UI window

Optimizations to Nested Prefabs

In the 2020 LTS, we’ve made several optimizations to Nested Prefabs. These optimizations aim to reduce modifications to the dynamic array of properties, update sorting strategies for the modification array, and harness a hash set for faster lookups.

Such changes, among others, accelerate Nested Prefab loading in-Editor by up to 20x, ultimately reducing time wasted between tasks.

This content is hosted by a third party provider that does not allow video views without acceptance of Targeting Cookies. Please set your cookie preferences for Targeting Cookies to yes if you wish to view videos from these providers.

Prefab importing and Quality of Life improvements

Finally, 2020 LTS offers a series of Editor changes for programmers and technical artists alike, to more efficiently set up workflows for the entire team.

These surround Prefab support for AssetPostprocessor, a Unity Editor API that lets you hook into the import pipeline and run scripts before or after importing assets. If OnPostprocessPrefab is implemented, the postprocessor can modify the Prefab. All added objects are then flagged with DontSaveInEditor to prevent changes from being applied to the source Prefab.

The enhanced Prefab import also serves to increase correctness, performance, scalability, and cacheability, alongside other key attributes. Regarding script dependencies, Prefabs that contain MonoBehaviours will now sync directly with the script, so as not to lose references in the case of compile errors.

Then there’s the Hierarchy view, which will now display the updated version control status for Prefabs. Multiple Prefabs can even be dragged into the scene simultaneously, to help you create rapidly.

How to get started with 2020 LTS

Upgrade today to access the latest Prefab optimizations and so much more. 

The Unity 2020 LTS provides a stable foundation for projects that are in production or about to ship. Download the most recent version from the Unity Hub here, and then let us know what you think about the enhanced Prefab workflows on our forum.

Preregister for your free copy of the Unity Game Designer Playbook

Prefabs are a crucial collaborative tool. They enable designers to work on the same scene by partitioning it into reusable parts. This way, each team member can test their work in the shared scene and streamline the overarching creative process.

If you want to know more about Prefabs and other updates in 2020 LTS, preregister for your free copy of the upcoming Unity Game Designer Playbook, a guide that reveals how to prototype, craft, and test gameplay effectively in Unity.

November 1, 2021 in Technology | 9 min. read
Topics covered