Search Issue Tracker

Active

Votes

2

Found in

2019.4

2020.1.6f1

2020.2

Issue ID

1279300

Regression

No

SerializedReference GameObject property gets set to null after entering Play mode

Serialization

-

How to reproduce:
1. Open the user's attached project
2. From the 'Scenes' folder open the 'SampleScene'
3. In the Hierarchy window select the 'ExampleGameObject' object
4. In the Inspector window click the round button on the right of the 'Example Prefab' variable slot
5. In the 'Select GameObject' window select the 'ExamplePrefab'
6. Enter the Play mode

Expected result: The 'ExamplePrefab' field's value doesn't become null
Actual result: The 'ExamplePrefab' field's value becomes null

Reproducible with: 2019.4.11f1, 2020.1.6f1, 2020.2.0b2
Cannot test with: 2018.4.27f1 (due to errors)

Comments (1)

  1. Cd72a3be3fe30ae979d7fc9317f5b411?d=mm

    Erdrik_Ironrose

    Sep 22, 2020 12:47

    To note, I tried changing the UnityGameObjectPrefabPropertyDrawer to see if it was a problem with the binding path.
    I have tried:
    - using prefabField.BindProperty(prefabProperty) instead of setting the .bindingPath.
    - using RegisterCallback and directly setting the .managedReferenceValue to a new instance, with the new value set and applying modified properties to the serialized object.

    Neither approach worked, although using the RegisterCallback also caused an ambiguous error in the console:
    "Could not udpate a managed instance value at property path 'examplePrefab', with value '1'" (including the typo in update).

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.