Search Issue Tracker

Won't Fix

Votes

0

Found in

2017.4

2017.4.30f1

2018.4

2019.2

2019.3

2020.1

Issue ID

1176049

Regression

No

Values are not assigned by script when prefab is dragged to Scene window and using Undo.RecordObject method

Scene Management

-

How to reproduce:
1. Open the attached 'project-1176049.zip' project using the EnvIronman VM (optional) (more information in Edit).
2. In Project window select 'Cube' prefab and drag it to the Scene window

Expected result: values are assigned by Script to prefab's variables
Actual result: values are not assigned by Script to prefab's variables

Reproducible with: 2017.4.32f1, 2018.4.7f1, 2019.2.2f1, 2019.3.0a12, 2020.1.0a1

Notes:
1) Dragging the prefab to the Hierarchy window assigns Script's values to the prefab's variables
2) Script's values are assigned to prefab's variables in both situations when 'Undo.RecordObject' method is not used
3) Dragging the prefab to Scene window (without releasing it) and then dragging it to the Hierarchy window throws the following exception:
ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
System.ThrowHelper.ThrowArgumentOutOfRangeException (System.ExceptionArgument argument, System.ExceptionResource resource) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
System.ThrowHelper.ThrowArgumentOutOfRangeException () (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
System.Collections.Generic.List`1[T].get_Item (System.Int32 index) (at <ad04dee02e7e4a85a1299c7ee81c79f6>:0)
UnityEditor.GameObjectTreeViewDataSource.GetItem (System.Int32 row) (at <a271a56180a643b0bef02438a8a1a5f9>:0)

  1. Resolution Note:

    Recording Undo during Awake() and OnEnable() is not supported.

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.