stride3d / stride3d/stride

Create Prefab from selection crashes if component order is different from the parent prefab

Open
#1,075 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-GameStudio bug
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:

  1. Create a prefab
  2. Add prefab to the scene
  3. 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.
  4. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.