Create Prefab from selection crashes if component order is different from the parent prefab
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 7.8k
- Forks
- 1.2k
- Avg merge
- 2d 17h
- Merged PRs (30d)
- 49
Description
Release Type: GitHub
Version: master
Platform(s): N/A
Describe the bug
When the order of components is modified on an instance of a prefab and you try doing 'Create Prefab from selection` we get an InvalidCastException that crashes the editor.
To Reproduce
Steps to reproduce the behavior:
- Create a prefab
- Add prefab to the scene
- Add a new component and after saving modify the ordering such that transform is not the first component.
I got here by doing a copy-paste of a component from another entity. - Try creating prefab from the modified entity. -> crash
Expected behavior
The ordering of the components should not matter, or if it does the editor should reorder them rather than crash.
Log and callstacks
stride_crash_callstack.txt
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the reproduction steps in the issue: create a prefab, reorder components so Transform is not first, and use Create Prefab from selection. Review stride_crash_callstack.txt to identify the InvalidCastException path. Done means the editor no longer crashes when component order differs from the parent prefab.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- devtools, game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100