This page lists changes in Unity 2023.2 which might affect existing projects when you upgrade them from a 2023.1 version to 2023.2.
Unity’s Progressive LightmapperA tool in Unity that bakes lightmaps according to the arrangement of lights and geometry in your scene. More info
See in Glossary no longer bakes the ambient probe and the skyboxA special type of Material used to represent skies. Usually six-sided. More info
See in Glossary Reflection ProbeA rendering component that captures a spherical view of its surroundings in all directions, rather like a camera. The captured image is then stored as a Cubemap that can be used by objects with reflective materials. More info
See in Glossary by default, and the Recalculate Environment Lighting setting in the Lighting window has been removed.
To avoid a newly created sceneA Scene contains the environments and menus of your game. Think of each unique Scene file as a unique level. In each Scene, you place your environments, obstacles, and decorations, essentially designing and building your game in pieces. More info
See in Glossary having no environment lighting, Unity assigns a default Lighting Data Asset containing environment lighting that matches the default skybox material.
You must select Generate Lighting in the Lighting window in the following cases:
If you rely on the previous automatic baking behavior but you use the default environment lighting settings, Unity upgrades the scene to use the default Lighting Data Asset.
The Auto Generate setting in the Lighting window has been removed, and related APIs are now obsolete.
To generate baked lighting for a scene, you can do any of the following:
Lightmapping.Bake
API.Lightmapping.BakeAsync
API.To check lightmapsA pre-rendered texture that contains the effects of light sources on static objects in the scene. Lightmaps are overlaid on top of scene geometry to create the effect of lighting. More info
See in Glossary while you’re editing, you can now select a Scene View Draw Mode and set Lighting Data to Preview. This displays a preview of the baked lighting. The preview lightmaps are non-destructive, and you can use them after you’ve baked the scene.
If a scene relies on auto-generated lighting, it no longer has its baked lighting. Select Generate Lighting in the Lighting window to re-bake the lighting manually.
If you use a script to open a scene, you must now use Lightmapping.Bake
or Lightmapping.BakeAsync
instead of waiting for auto-generated lighting to complete.
The following graphics formats, which were previously deprecated in 2022.1, are now obsolete and produce compile errors if you use them:
GraphicsFormat.DepthAuto
GraphicsFormat.ShadowAuto
GraphicsFormat.VideoAuto
The GraphicsFormatUtility.GetGraphicsFormat API no longer returns the obsolete formats. Instead it does the following:
RenderTextureFormat.Depth
to GraphicsFormat.None
instead of GraphicsFormat.DepthAuto
. GraphicsFormat.None
indicates depth-only rendering.RenderTextureFormat.Shadowmap
to GraphicsFormat.None
instead of GraphicsFormat.ShadowAuto
. If you create a render textureA special type of Texture that is created and updated at runtime. To use them, first create a new Render Texture and designate one of your Cameras to render into it. Then you can use the Render Texture in a Material just like a regular Texture. More infoGraphicsFormat.None
format, you must set RenderTextureDescriptor.shadowSamplingMode to ShadowSamplingMode.CompareDepths to enable depth-compare sampling.Because GraphicsFormat.DepthAuto
and GraphicsFormat.ShadowAuto
were both considered depth stencil formats but used as colors formats, you may need to adjust your code.
For example, in the following snippet, GraphicsFormatUtility.IsDepthFormat
returns false
instead of true
:
RenderTextureDescriptor desc = new RenderTextureDescriptor(256, 256, RenderTextureFormat.Depth, 32); bool isDepthOnly = GraphicsFormatUtility.IsDepthFormat(desc.graphicsFormat);
To check if a RenderTexture
or RenderTextureDescriptor
is depth-only, use one of the following:
if (renderTexture.graphicsFormat == GraphicsFormat.None && renderTexture.depthStencilFormat != GraphicsFormat.None)
if (renderTexture.format == RenderTextureFormat.Depth || renderTexture.format == RenderTextureFormat.Shadowmap)
Runtime-created 2D textures will no longer have their mipmap upload limited by default. Before, mipmap limits had to be disabled explicitly via the Texture2D constructor (by providing an ignoreMipmapLimit
boolean parameter when the constructor is called with a TextureFormat, or the IgnoreMipmapLimit
TextureCreationFlag when it’s called with a GraphicsFormat), or by toggling tex.ignoreMipmapLimit
of a constructed texture. This behavior has changed: mipmap limits are now opt-in for runtime-created 2D textures.
Without making project changes, in the following cases users miss out on GPU bandwidth and memory optimizations, and potentially see a better quality than intended because textures are now getting uploaded at full resolution:
In following cases, users are not affected by this change:
false
for ignoreMipmapLimit
,tex.ignoreMipmapLimit
to false
after construction.These users may want to upgrade their scriptsA piece of code that allows you to create your own Components, trigger game events, modify Component properties over time and respond to user input in any way you like. More info
See in Glossary if they use deprecated constructors.
To upgrade your scripts, use a Texture2D constructor with a MipmapLimitDescriptor
to indicate that a runtime Texture should be affected by the quality settings.
This change was made for consistency with the new mipmap limit support for Texture2DArrays. Rather than having each texture shape define its own default mipmap limit behavior, we opt for consistency and have decided that runtime textures should explicitly enable mipmap limits. This opt-in behavior is preferred over opt-out because runtime textures are often used in more versatile ways where unexpectedly uploading fewer mips than expected could be more harmful than unexpectedly uploading more mips.
Simplified the creation of custom controls with UXML in UI(User Interface) Allows a user to interact with your application. Unity currently supports three UI systems. More info
See in Glossary Toolkit to speed up the workflow and make it more intuitive.
A key improvement is the introduction of UxmlElement and UxmlAttribute attributes. These attributes simplify attribute authoring and automatically derive the attribute names from property names, eliminating the need for UxmlTraits and UxmlFactory classes.
You can now create custom attribute converters for specific data types, ensuring seamless conversion of values to and from UXML attribute strings. We’ve also enhanced UxmlObjects, allowing custom, non-visual elements to be defined within visual elementsA node of a visual tree that instantiates or derives from the C# VisualElement
class. You can style the look, define the behaviour, and display it on screen as part of the UI. More info
See in Glossary. The new system leverages the Unity serialization and uses a source generator to create UxmlSerializedData classes for elements from all UxmlAttribute definitions for each custom element class, enabling support for custom property drawersA Unity feature that allows you to customize the look of certain controls in the Inspector window by using attributes on your scripts, or by controlling how a specific Serializable class should look More info
See in Glossary, decorators, and various attributes.
The introduction of “attribute overrides” allows you to customize the behavior of UXML attributes, and provides flexibility when you work with inherited attributes. These improvements provide a more efficient and user-friendly experience for creating complex UI elements in Unity 2023.2 and beyond.
For example, the following code sample is a custom control created with UxmlFactory
and UxmlTraits
:
public class HealthBar : VisualElement { private const float k_LowValue = 0; private const float k_HighValue = 100; // Declare as usable with Uxml public new class UxmlFactory : UxmlFactory<HealthBar, UxmlTraits> { } // Define attributes (and connect with class properties) for Uxml public new class UxmlTraits : BindableElement.UxmlTraits { UxmlColorAttributeDescription m_Color = new UxmlColorAttributeDescription { name = "color", defaultValue = Color.white }; UxmlFloatAttributeDescription m_Value = new UxmlFloatAttributeDescription { name = "value", defaultValue = k_HighValue }; public override void Init(VisualElement ve, IUxmlAttributes bag, CreationContext cc) { base.Init(ve, bag, cc); var bar = ve as HealthBar; bar.color = m_Color.GetValueFromBag(bag, cc); bar.value = m_Value.GetValueFromBag(bag, cc); } } public Color color { get; set; } [Range(k_LowValue, k_HighValue)] public float value { get; set; } }
The following code sample does the same thing as the previous code sample, but uses the new UxmlElement
and UxmlAttributes
system:
[UxmlElement] public class HealthBar2 : VisualElement { private const float k_LowValue = 0; private const float k_HighValue = 100; [UxmlAttribute] public Color color { get; set; } = Color.white; [UxmlAttribute] [Range(k_LowValue, k_HighValue)] public float value { get; set; } = k_HighValue; }
For more examples and information, refer to Unity UI Toolkit documentation, and stay tuned for an in-depth blog post this fall.
The Assets/Create menu has been reorganized and categorized. As part of this overhaul, the Unity Built-In ScriptTemplate files have been renamed.
Users who have added elements to the Assets/Create menu with either CreateAssetMenuAttribute``, MenuItemAt
tribute or a Custom ScriptTemplate might want to change their menu item’s priority as it’s placement relative to other elements is now different.
Users who were creating assets by executing these menu items with the EditorApplication.ExecuteMenuItem
API, must verify the new path to the menu item.
Users who have previously overridden the Unity Built-In ScriptTemplates must update the names of their override files to ensure they match the new names of the Built-In Templates.
The ExecuteDefaultAction
and ExecuteDefaultActionAtTarget
methods have been deprecated. The following methods are added to replace them:
HandleEventTrickleDown
HandleEventBubbleUp
Unity executes these new methods on each element in the event dispatching path immediately after TrickleDown
and before BubbleUp
callbacks of that element. During those methods, the dispatching phase is set to TrickleDown
or BubbleUp
accordingly and the event’s `currentTarget`` coincides with the element executing the method.
The AtTarget
dispatching phase and the PreventDefault
method have been deprecated. Calling StopPropagation
or StopPropagationImmediately
now stops further executing HandleEventTrickleDown
and HandleEventBubbleUp
at the same time as it stops further invocation of the TrickleDown
and `BubbleUp`` callbacks.
In most cases, if you don’t upgrade to the new methods, your code should not alter its behavior significantly. UI Tookkit still calls the obsolete methods in the same order as before, or with minimal adjustments. However, all the standard controls within UI Toolkit have migrated to using the new methods, aligning their logic execution order accordingly. Mixing calls to obsolete methods with the use of upgraded controls might lead to some logic being out of sync compared to previous Unity versions.
To upgrade existing code to the new methods, proceed as follows:
ExecuteDefaultAction
and ExecuteDefaultActionAtTarget
by HandleEventBubbleUp
and PreventDefault
by StopPropagation
(or remove calls to PreventDefault
if StopPropagation
has already been called in the same code block. This covers the majority of cases).PreventDefault
during a BubbleUp
callback, which is no longer possible and can’t be replaced by StopPropagation because the event has already reached its target, consider adding a callback during the TrickleDown
phase to call StopPropagation
. This step is generally sufficient to address such scenarios.Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.
When you visit any website, it may store or retrieve information on your browser, mostly in the form of cookies. This information might be about you, your preferences or your device and is mostly used to make the site work as you expect it to. The information does not usually directly identify you, but it can give you a more personalized web experience. Because we respect your right to privacy, you can choose not to allow some types of cookies. Click on the different category headings to find out more and change our default settings. However, blocking some types of cookies may impact your experience of the site and the services we are able to offer.
More information
These cookies enable the website to provide enhanced functionality and personalisation. They may be set by us or by third party providers whose services we have added to our pages. If you do not allow these cookies then some or all of these services may not function properly.
These cookies allow us to count visits and traffic sources so we can measure and improve the performance of our site. They help us to know which pages are the most and least popular and see how visitors move around the site. All information these cookies collect is aggregated and therefore anonymous. If you do not allow these cookies we will not know when you have visited our site, and will not be able to monitor its performance.
These cookies may be set through our site by our advertising partners. They may be used by those companies to build a profile of your interests and show you relevant adverts on other sites. They do not store directly personal information, but are based on uniquely identifying your browser and internet device. If you do not allow these cookies, you will experience less targeted advertising. Some 3rd party video providers do not allow video views without targeting cookies. If you are experiencing difficulty viewing a video, you will need to set your cookie preferences for targeting to yes if you wish to view videos from these providers. Unity does not control this.
These cookies are necessary for the website to function and cannot be switched off in our systems. They are usually only set in response to actions made by you which amount to a request for services, such as setting your privacy preferences, logging in or filling in forms. You can set your browser to block or alert you about these cookies, but some parts of the site will not then work. These cookies do not store any personally identifiable information.