Search Issue Tracker
By Design
By Design in 2020.3.X
Votes
0
Found in
2020.3.42f1
Issue ID
UUM-20403
Regression
No
NullReferenceException errors appear when using "select half" button
How to reproduce:
1. Download and open the attached project
2. In the Project window, select both prefabs
3. In the Inspector window, press "Select half"
Expected outcome: One prefab is selected
Actual outcome: "NullReferenceException" and "IndexOutOfRangeException" errors appear in the console window
Reproducible with: 2020.3.42f1, 2021.3.15f1, 2022.1.24f1, 2022.2.1f1, 2023.1.0a21
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
- Shader warning in 'Hidden/Core/DebugOccluder' thrown after building High Definition 3D Sample Template
- Audio Mixer “+” buttons overlap with UI when the Audio Mixer window layout is set to Horizontal
- "Clear" button in the "Set project display name" closes all the pop-up instead of clearing just a name from the field
- Video Player renders no video on specific devices when using Vulkan
- The Editor slows itself down by showing tons of warnings when the majority of TransformAccessArrays content are NullRefs
Resolution Note:
The supplied user script Header.cs appears to confuse editor.targets with Selection.objects. The corrected script's Draw method is:
public static void Draw(Editor editor)
{
editor.ResetTarget();
if (Selection.objects.Length < 2)
{
GUI.color = Color.yellow;
GUILayout.Label("select more");
return;
}
GUI.color = Color.green;
if (GUILayout.Button("select half"))
{
int count = Selection.objects.Length / 2;
Object[] selection = new Object[count];
for (int i = 0; i < count; ++i)
{
selection[i] = Selection.objects[i];
}
Selection.objects = selection;
}
}
With these changes and two assets selected in the Project window, clicking the "select half" button results in expected behavior with a single Prefab selected and no exceptions in the Console.
Resolution Note (2020.3.X):
The supplied user script Header.cs appears to confuse editor.targets with Selection.objects. The corrected script's Draw method is:
public static void Draw(Editor editor)
{
editor.ResetTarget();
if (Selection.objects.Length < 2)
{
GUI.color = Color.yellow;
GUILayout.Label("select more");
return;
}
GUI.color = Color.green;
if (GUILayout.Button("select half"))
{
int count = Selection.objects.Length / 2;
Object[] selection = new Object[count];
for (int i = 0; i < count; ++i)
{
selection[i] = Selection.objects[i];
}
Selection.objects = selection;
}
}
With these changes and two assets selected in the Project window, clicking the "select half" button results in expected behavior with a single Prefab selected and no exceptions in the Console.