Search Issue Tracker
Duplicate
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
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)
-
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
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Lightmap has artifacts when Generating Lighting
- Editor crashes when starting a new game session using Direct3D12 Graphics API
- Play on awake does not work with an audio random container when instantiating a game object
- Play on awake does not work with an audio random container when loading a scene
- Prefab components are not rendered correctly in the Inspector Window when "HideFlags.HideInInspector" is used
This is a duplicate of issue #1237191