Search Issue Tracker

By Design

By Design in 2023.2.X

Votes

0

Found in

2020.3.48f1

2021.3.26f1

2022.2.21f1

2023.1.0b18

2023.2.0a17

Issue ID

UUM-36614

Regression

No

Types from serialized references on Prefabs are not updated when moving Scripts among assemblies

Serialization

-

Reproduction steps:
1. Open the attached “1563442.zip“ project
2. Move the “CustomPassTest.cs” Script to the “Assembly1" folder
3. Select “PrefabCamera.prefab” Prefab and observe the Console

Expected result: No errors are thrown
Actual result: “ArgumentNullException: Value cannot be null. Parameter name: key” errors are thrown

Alternate reproduction steps:
1. Open the attached “1563442.zip“ project
2. Open “PrefabCamera.prefab” with any text editor
3. Observe the type of the Custom Pass Object
4. Move the “CustomPassTest.cs” Script to the “Assembly1" folder in the Editor
5. Repeat steps 2-3

Alternate expected result: The type of the Custom Pass Object is updated
Alternate actual result: The type of the Custom Pass Object is not updated

Reproducible with: 2020.3.48f1, 2021.3.26f1, 2022.2.21f1, 2023.1.0b18, 2023.2.0a17

Reproduced on: macOS Ventura 13.3.1 (Intel)

Note: Not reproducible in Player

  1. Resolution Note:

    Moving scripts among assemblies can not be automatically detected. This is a limitation caused by the design of the SerializedReference-s. However there is an attribute called "MovedFrom" which allows to specify if a script has been moved from another assembly, namespace or class with another name. the attribute can be used like this:
    After the script is moved to another assembly, add the MovedFrom attribute to it showing what was the original assembly the script was in

    [MovedFrom(true, sourceAssembly:"Assembly-CSharp")]
    class CustomPassTest : CustomPass

  2. Resolution Note (2023.2.X):

    Moving scripts among assemblies can not be automatically detected. This is a limitation caused by the design of the SerializedReference-s. However there is an attribute called "MovedFrom" which allows to specify if a script has been moved from another assembly, namespace or class with another name. the attribute can be used like this:
    After the script is moved to another assembly, add the MovedFrom attribute to it showing what was the original assembly the script was in

    [MovedFrom(true, sourceAssembly:"Assembly-CSharp")]
    class CustomPassTest : CustomPass

Add comment

Log in to post comment

All about bugs

View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.