stride3d / stride3d/stride

Copy/Paste of prefabs or archetypes loses overrides

Open
#2,953 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

area-Asset area-GameStudio area-Serialization bug priority-high
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:

  1. Create a new game using the default template.
  2. Create a derived asset from the SphereMaterial (right-click "Create derived assset".
  3. Change the diffuse map to use the Gold color from the palette.
  4. Notice that the property is bold in the property grid, indicated that it is overridden (compared to the base value in the base asset).
  5. Copy the dervied asset.
  6. Paste.
  7. 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

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 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.