Note: Follow the advice in this section in release order. For example, if you need to upgrade your project from 2018 to 2020, read the 2019 upgrade guides to see if there are any changes that you need to make before you read the 2020 upgrade guides.
This page lists changes in Unity 2018 LTS which might affect existing projects when you upgrade from a Unity 2017 version.
Note that 2018 LTS is also known as 2018.4.
flex-grow
, flex-shrink
and flex-basis
. The flex-shrink and flex-basis parameters are optional. If omitted, flex-basis defaults to 0 and flex-shrink defaults to 1.flex: N
was equivalent to flex N 0 auto
. This now follows the CSS standard by making it equivalent to flex: N 1 0
. To preserve the old semantic, you should replace all flex: N
directives with flex: N 0 auto
in your USS files.Physics behaviour has changed and some Projects may behave differently with the new version. In particular:
Unity 2018.3 includes some particle bugs fixes and this can affect your projects that were created in a previous version.
Before 2018.3, the Unity Editor used the mono C# compiler (mcs) when compiling C# files in a project. From 2018.3 onwards, the Roslyn C# compiler (csc) is used for projects targeting the new scripting runtime (.NET 4.x Equivalent). Different behavior may be noticed from the switch to Roslyn:
csc.rsp
. See PlatformDependentCompilation.UnityScript (.js) and Boo (.boo) script files can no longer be compiled in the Editor.
For more information see this blog post from August 2017 and you can use the unityscript2csharp tool to convert UnityScript to C#.
Animator Root MotionMotion of character’s root node, whether it’s controlled by the animation itself or externally. More info
See in Glossary playback has changed slighly to correct some inconsistencies when authoring Root Motion Animations in the Animation Window.
Case | Generated Root Motion | Animator.applyRootMotion | 2018.2 | 2018.3 & 2018.4 (LTS) |
---|---|---|---|---|
A | yes | yes | Apply Root Motion cumulatively on Root TransformThe Transform at the top of a hierarchy of Transforms. In a Prefab, the Root Transform is the topmost Transform in the Prefab. In an animated humanoid character, the Root Transform is a projection on the Y plane of the Body Transform and is computed at run time. At every frame, a change in the Root Transform is computed, and then this is applied to the GameObject to make it move. More info See in Glossary. |
Same as 2018.2 |
B | no | no | Apply Position, Rotation and Scale curves as authored in the AnimationClip. | Same as 2018.2 |
C* | yes | no | No root transform movement | Apply Position, Rotation and Scale as authored in the AnimationClip. |
D* | no | yes | No root transform movement | Apply Root Motion cumulatively on Root. |
For cases C and D, to achieve the same result in 2018.3, you need to implement OnAnimatorMove, then discard Animator.deltaPosition
and Animator.deltaRotation
in cases where you don’t want to apply Root Motion.
If your Project uses applyRootMotion
to “mute” Position, Rotation and Scale Animation on your Root Transform, then you need to override the Root Transform properties manually.
The UIElements.ContextualMenu
menu action callbacks now takes a ContextualMenu.MenuAction
parameter instead of an EventBase
parameter.
ContextualMenu.InsertSeparator
takes an additional string
parameter.
This feature was deprecated in Unity 5.1 and has now been removed. You can no longer use it in your projects in Unity 2018.2.
See the Multiplayer and Networking section for more information on networkingThe Unity system that enables multiplayer gaming across a computer network. More info
See in Glossary in Unity.
When having actual transparency, Photoshop will tweak pixelThe smallest unit in a computer image. Pixel size depends on your screen resolution. Pixel lighting is calculated at every screen pixel. More info
See in Glossary colors to blend them with matte (background) color. The process of preparing alpha channels properly is described in our how to prepare alpha channels documentation.
You can ignore dilation in this document, the important part is the note that states that you want to have an “opaque” image with a separate alpha channel/mask (instead of having transparency). Unity tweaked colors to “remove” matte, but this has ceased as of 2018.2. If you had PSD with transparency you might start seeing white color on the edges. To fix this, consult the manual link above and make an actual alpha channel (instead of transparency).
Historically, when a GameObject is disabled or destroyed, it stops all running coroutines on its children MonoBehaviours. In certain cases, however, coroutines started from methods called during these times (for example, OnBecameInvisible()
) were previously allowed to start. This led to component order-specific behavior and, in some cases, crashes.
In Unity 2018.1, coroutines returned during GameObject disable or destroy are no longer started.
The BuildPipeline APIs, such as BuildPipeline.BuildPlayer
, and BuildPipeline.BuildAssetBundles
, previously returned a string. This was empty if the build succeeded and contained an error message if the build failed.
In 2018.1, this has been replaced with the new BuildReport object, which contains much richer information about the build process.
To check whether the build succeeded, retrieve the summary
property of the report object, and check its result property - it will be BuildResult.Succeeded
for a successful build. For example:
var report = BuildPipeline.BuildPlayer(...);
if (report.summary.result != BuildResult.Succeeded)
{
throw new Exception("Build failed");
}
Previously, to be notified when the Unity standalone player was quitting, you would implement the OnApplicationQuit
method on a MonoBehaviour and to abort the player from quitting you would call Application.CancelQuit
.
Two new events have been introduced. These are Application.wantsToQuit
and Application.quitting
. You can listen to these events to get notified when the Unity standalone player is quitting. Application.wantsToQuit
is called when the player is intending to quit, the listener for wantsToQuit
must return true or false. Return true if you want the player to continue quitting or false to abort the quit. The Application.quitting
event is called when the player is guaranteed to quit and cannot be aborted.
Application.CancelQuit
has been deprecated, please use the Application.wantsToQuit
instead.
using UnityEngine;
public class PlayerQuitExample
{
static bool WantsToQuit()
{
// Do you want the editor to quit?
return true;
}
static void Quit()
{
Debug.Log("Quitting the Player");
}
[RuntimeInitializeOnLoadMethod]
static void RunOnStart()
{
Application.wantsToQuit += WantsToQuit;
Application.quit += Quit;
}
}
This change affect the following runtime platform: WSAPlayerX86, WSAPlayerX64, and WSAPlayerARM.
There is no replacement for now.
There is a new TouchScreenKeyboard.status that can be queried to cover the deprecated states and more states.
MonoDevelop 5.9.6 has been replaced by Visual Studio for Mac on macOS as the bundle C# script editor in the macOS installer. Visual Studio 2017 Community is now the only C# script editor installed with Unity on Windows.
When it is installed in the default location next to the Unity executable, Unity no longer recognises MonoDevelopAn integrated development environment (IDE) supplied with Unity 2017.3 and previous versions. From Unity 2018.1 onwards, MonoDevelop is replaced by Visual Studio. More info
See in Glossary as the “MonoDevelop (built-in)” external script editor in preferences. When no C# code editor is installed and selected in preferences, Unity uses the system default application for opening C# (.cs) scripts.
The BuildPipeline callback interfaces: IPreprocessBuild
, IPostprocessBuild
and IProcessScene
have been changed so that they now require you to pass in a BuildReport
object. This replaces the previous parameters for build path / target platform; you will need to change your code if you are implementing these interfaces.
Both the build path and the target platform can be accessed via the BuildReport
object. The build path is now report.summary.outputPath
and the target platform is report.summary.platform
.
Previously, assets located in plugin folders (for example, in directories with the extension .bundle, .plugin, or .folder) were imported using specialized importers. Textures were imported via texture importers, AudioClips via the audio importer, etc. Now all those assets will be imported using default importer, that means you won’t be able to reference those assets like you did before, because they no longer have a specialized type (Texture, AudioClip, etc). Plugin folders are contained packages, thus assets inside shouldn’t be accessible externally, except through plugin accessing techniques.
To continue using those assets, you’ll need to move them outside of your plugin folders.
The mathematical formula used for applying pivot offsets to Meshes was incorrect, and was inconsistent with how it worked for Billboard particles. To achieve the correct scale, the Pivot Offset should be multiplied by the size of the particle, so a Pivot Offset of 1 is equal to one full width of the particle.
For Meshes, the size was being multiplied twice, meaning the pivot amount was based on the squared particle size. This made it impossible to get consistent results in systems containing varying sized particles.
For systems using particles of equal size, the formula can be reverse-engineered to decide how much to adjust the pivot offset by, to compensate for this change in behavior:
Old formula: offset = size * size * pivot
New formula: offset = size * pivot
Therefore, if all particles are of equal size:
newOffset = pivot / size
In systems where the size varies between particles, a visual reassessment of the systems in question will be necessary.
From 2018.1, Global IlluminationA group of techniques that model both direct and indirect lighting to provide realistic lighting results.
See in Glossary (GI) is supported by GPU Instancing rendering in Unity. Each GPU instance can support GI coming from either different Light ProbesLight probes store information about how light passes through space in your scene. A collection of light probes arranged within a given space can improve lighting on moving objects and static LOD scenery within that space. More info
See in Glossary, one lightmapA 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 (but different region in the atlas), or one Light Probe Proxy VolumeA component that allows you to use more lighting information for large dynamic GameObjects that cannot use baked lightmaps (for example, large Particle Systems or skinned Meshes). More info
See in Glossary component (baked for the space volume containing all the instances). Standard shaders and surface shadersA streamlined way of writing shaders for the Built-in Render Pipeline. More info
See in Glossary come with these changes automatically, but you need to update custom shader code to enable these features.
Complex handles in the UnityEditor.IMGUI.Controls namespace, such as BoxBoundsHandle, CapsuleBoundsHandle, SphereBoundsHandle, ArcHandle, and JointAngularLimitHandle have delegates that can be assigned to, in order to alter the appearance of their control points. Previously, assigning a value of null to these delegates would fall back to a default behavior. Assigning a value of null to them now results in no behavior, making it easier to disable particular control handles. Respectively, each class now has public API points for the default methods if you need to reset the control handles to their default behavior.
Compiling ‘unsafe’ C# code now requires the Allow ‘unsafe’ code option to be enabled in the Player SettingsSettings that let you set various player-specific options for the final game built by Unity. More info
See in Glossary for predefined assemblies (like Assembly-CSharp.dll) and in the inspectorA Unity window that displays information about the currently selected GameObject, asset or project settings, allowing you to inspect and edit the values. More info
See in Glossary for Assembly Definition Files assemblies. Enabling this option will make Unity pass /unsafe option to the C# compiler when compiling scripts.
In 2017.2 and 2017.3, the Unity Package Manager introduced the UnityPackageManager directory, which was used to store a file named manifest.json. Package content could be accessed by scripts using virtual relative paths starting with PackagesPackages are collections of assets to be shared and re-used in Unity. The Unity Package Manager (UPM) can display, add, and remove packages from your project. These packages are native to the Unity Package Manager and provide a fundamental method of delivering Unity functionality. However, the Unity Package Manager can also display Asset Store packages that you downloaded from the Asset Store. More info
See in Glossary.
In 2018.1, the UnityPackageManager directory has been renamed to Packages for consistency with the virtual relative paths of packaged assets. The manifest.json file should automatically be moved to the new directory.
As a result:
If your project uses a Version ControlA system for managing file changes. You can use Unity in conjunction with most common version control tools, including Perforce, Git, Mercurial and PlasticSCM. More info
See in Glossary System (VCS) such as PerforceA version control system for file change management. More info
See in Glossary or Git, it may be necessary to update its configuration to track the Packages directory instead of the UnityPackageManager directory.
If your project uses Nuget (or any external package manager) in a way that makes it use the Packages directory, its configuration should be changed to use a different directory. This is recommended to eliminate the small chance that a package be picked up by the Unity Package Manager, which could result in hard-to-debug issues like compilation errors or import errors.
After migrating to the new directory, the UnityPackageManager directory can safely be deleted.