Copy/Paste of prefabs or archetypes loses overrides
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: Since 4.2.0.2042
Platform(s): Windows (GameStudio)
Describe the bug
Since changes introduced in #1875, pasting a prefab or a derived asset (archetype) with overridden values is broken. The overrides are lost in the pasted item.
To Reproduce
Steps to reproduce the behavior:
- Create a new game using the default template.
- Create a derived asset from the SphereMaterial (right-click "Create derived assset".
- Change the diffuse map to use the Gold color from the palette.
- Notice that the property is bold in the property grid, indicated that it is overridden (compared to the base value in the base asset).
- Copy the dervied asset.
- Paste.
- Notice that the pasted asset doesn't have the Gold color but the same as the base asset. In other words the override was lost.
Minimal project: MyGame2.zip
Expected behavior
The overrides should be kept in the pasted asset. It was working in earlier versions of Stride.
Screenshots
If applicable, add screenshots to help explain your problem (use GitHub drag & drop)
Log and callstacks
Copying is still fine as the serialized yaml still contains the override flag (*).
!CopyPasteData
ItemType: '!System.Collections.Generic.List%601[[Stride.Core.Assets.AssetItem,Stride.Core.Assets]],System.Private.CoreLib'
Items:
- Data: !System.Collections.Generic.List%25601[[Stride.Core.Assets.AssetItem,Stride.Core.Assets]],System.Private.CoreLib
1d163bf7e33bd2a3f039c06c218213e3:
Location: !file Sphere Material-Derived
Asset: !MaterialAsset
Id: 4a9056cf-54a8-46ec-8366-7404b746019e
SerializedVersion: {Stride: 2.0.0.0}
Tags: []
Archetype: d0fbcff9-1bdd-47fc-810e-922c5d012a22:Sphere Material
Attributes:
MicroSurface: !MaterialGlossinessMapFeature
GlossinessMap: !ComputeFloat
Value: 0.65
Diffuse: !MaterialDiffuseMapFeature
DiffuseMap: !ComputeColor
Value*: {R: 1.0, G: 0.8856508, B: 0.6091625, A: 1.0}
DiffuseModel: !MaterialDiffuseLambertModelFeature {}
Specular: !MaterialMetalnessMapFeature
MetalnessMap: !ComputeFloat
Value: 1.0
SpecularModel: !MaterialSpecularMicrofacetModelFeature
Fresnel: !MaterialSpecularMicrofacetFresnelSchlick {}
Visibility: !MaterialSpecularMicrofacetVisibilitySmithSchlickGGX {}
NormalDistribution: !MaterialSpecularMicrofacetNormalDistributionGGX {}
Environment: !MaterialSpecularMicrofacetEnvironmentGGXLUT {}
Overrides:
UVScale: {X: 1.0, Y: 1.0}
Layers: {}
AlternativePath: null
Additional context
I narrowed down the regression to the change in sources/core/Stride.Core.Reflection/TypeDescriptors/ObjectDescriptor.cs from PR #1875.
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 in sources/core/Stride.Core.Reflection/TypeDescriptors/ObjectDescriptor.cs and review the change introduced by PR #1875. Reproduce the derived SphereMaterial copy/paste case using the provided steps, then verify that the pasted asset retains the overridden DiffuseMap value and its serialized override marker.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- game-dev, tooling
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 52/100