Search Issue Tracker

Fixed in 2018.3.X

Fixed in 2019.1.X

Votes

51

Found in

2018.3.0b1

2018.3.0f2

2019.1.0a1

2019.2.0a1

Issue ID

1116476

Regression

Yes

Prefab's references are lost when modifying prefab

Scene Management

-

How to reproduce:
1. Open attached "PrefabReferenceLostRepro.zip" project
2. Go to Assets -> Scenes and open 'SampleScene'
3. Click on 'Spawner' and call 'Log' in the ContextMenu in the Inspector
4. Observe the Console
5. Go to Assets, open Enemy in Prefab Mode and edit it (e.g. change the position)
6. Repeat 3, 4 steps

Expected result: Console returns 'Enemy(Enemy)'
Actual result: Console returns 'null'

Reproducible: 2018.3.2f1, 2019.1.0a14, 2019.2.0a1
Not reproducible: 2017.3.0a1, 2017.4.18f1, 2018.3.0a11

Fixed in: 2018.3.6f1, 2019.1.0b4, 2019.2.0a6

Comments (46)

  1. Abf7b4a0795169d2a4f65d0f9529adbc?d=mm

    Izitmee

    Feb 03, 2019 19:32

    I investigated this a lot to find a workaround, and reached the conclusion that the new prefab system does a terrible thing: each time a prefab is saved it is now actually recreated, not updated. That means that, while serialized references are kept (GUID based), normal references are lost. It is really, really bad.
    The best workaround I found is to use Unity's AssetModificationProcessor to store the path of the saved prefabs just before they are saved, then use an AssetPostprocessor to reload them from said path after they have been reimported. It's a delicate hell :|

  2. 2c4ae0c80b10e812d44f7789dcac2542?d=mm

    tweedie

    Jan 31, 2019 23:49

    Why is this not Priority 1? The tooltip for Priority 1 mentions "data loss" - this bug nulls out your references. It's entirely project breaking. It fundamentally breaks how Unity is meant to work.

    2019.1 cannot ship with this, it's bad enough it made it to 18.3; it renders the new prefab workflow redundant for anything with a mono reference. Very sad, because nested prefabs are fantastic!

  3. Dd5d04f54945a127d2b650f84fb5e944?d=mm

    SaltwaterAssemnly

    Jan 30, 2019 09:59

    Please fix asap!

  4. F48e8c87a51c304e14221278f3d74242?d=mm

    trenthm

    Jan 16, 2019 15:06

    Same as @NONGBENZGAMES for me

  5. F48e8c87a51c304e14221278f3d74242?d=mm

    trenthm

    Jan 16, 2019 15:05

    Same as @NONGBENZGAMES for me

  6. D695d3e808fb3b83312d654cfb9de5c5?d=mm

    nongbenzgames

    Jan 13, 2019 13:05

    I too have references in other scripts going missing when updating prefabs. Components randomly get new FileIDs for some reason according to my Git. This has happened since the beginning of new prefab workflows to the latest 2019 alpha13. Not sure if it's due to a faulty upgrade process but this has been project breaking for months and needs attention.

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.