Refactoring a used ScriptComponent into a regular object crashes the editor
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: Official Release
Version: 4.1.0.1898
Platform(s): Windows
Describe the bug
When a class changes from being derived from ScriptComponent to not being derived from ScriptComponent, if the component exists on any entity in the editor, the editor crashes, and the scene is corrupted.
To Reproduce
Steps to reproduce the behavior:
- Write a C# script component that derives from StartupScript
- Add your new component to an entity in a scene
- Change your C# script to no longer derive from StartupScript
- Go back to the editor. It may hang while trying to refresh.
- Close the editor.
- Try to open the project. It will fail, claiming the scene has an invalid entry (the class)
Expected behavior
The scene loads, without the problematic components, and shows an error message explaining why they disappeared.
Screenshots
Log and callstacks
Here's the initial error that tipped me off:
Error: Failed to load asset from path [D:/Development/Stride/Project/Assets/Scenes/MainScene.sdscene]. Reason: The path [(object).Hierarchy.Parts[4a3698cc-b543-4e96-b3b6-3328ce22bbf3].Entity.Components{1d7130cb87d74b109c0a4e5de1327b61}.NextNode] contains a non-valid item id on a collection.
Additional context
N/A
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
No source files or tests are named. First reproduce the failure using the listed StartupScript steps on Windows, then trace the editor's scene refresh and load handling for the invalid component entry. Done means the scene opens without the removed component and reports why it disappeared.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100