[Asset] Slightly complex prefabs and scenes are effectively unusable
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 7.8k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 54
Description
Release Type: Github
Version: Latest
Platform(s): Windows editor
Describe the bug
TL;DR: slightly complex scenes and prefabs are pretty much unusable because of the time the editor takes to save changes and add them to scenes.
-
Details
Modifying scenes and prefabs, drag&drop and other operations with those features takes an absurdly large amount of time and often ends in crashes in more complex scenarios, just dropping a prefab containing a couple of children in a scene can take more than a minute and will crash the game studio once the amount of children increases further. -
Profiling
When profiling a drag and drop we can see that a lot of time is taken by reflection and fighting the GC with allocations but both of those doesn't take most of the time anyway (around 20%), the rest is spent all over the place in quantum so this is most likely a design issue.
some of the functions where called more than 4.000.000 times and it was barely a fourth of the way to completion. -
Question
All of that work is to setup binding instance to the source prefab's for changes to cascade over, right ? I don't really understand why this needs to happen for a drag and drop operation, shouldn't this happen once a modification to the source has been made ? -
Potential Solution
Loading from disk works fairly well even though that would require accessing files and parsing them which seems like it should take longer but clearly doesn't here, perhaps we should only write the changes to disk on save and propose to users to reload their opened scene if they contain changed prefabs ?
To Reproduce
Steps to reproduce the behavior:
- Extract this zip: MyGame7.zip
- Load the solution in game studio
- Drag and drop
MediumPrefabin the scene view/hierarchy - Gamestudio will now block for the next couple of minutes or might just crash before successfully adding that prefab to the scene.
Additional context
I initially started investigating this because I had a prefab made out of around 2000 fairly simple items, the scene editor opened that prefab in a couple of second at most but drag and dropping it inside another scene led to a seemingly never ending load. I understand that 2000 items is perhaps too large for one prefab to hold but I don't think we should expect such an operation to either block for more than 20 minutes and/or crash afterward.
If you don't have time to @xen2 I can work on this but I only have a couple of days to do so and I need some pointers:
- How is this whole system architectured ?
- Where is it used ?
- Why do we need all of this quantum reflection stuff when we actually generate serializers for binary serialization ?
- Is what I proposed above in
Potential Solutionfeasible
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
Reproduce the slowdown by loading the linked MyGame7.zip in Game Studio and dragging MediumPrefab into the scene view or hierarchy. Use profiling to investigate the reflection, garbage-collection allocations, and repeated calls described in the report. Done means complex prefab and scene operations no longer block for minutes or commonly crash, with the behavior checked against the reported reproduction.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop, game-dev, performance
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100