Skip to content

ParticleEffectSerializer must update Texture2D name when using relative path to shared non-local-pathed texture #1165

Description

@walteryoung

Description

When a particle effect uses a Texture2D in a non-local path that is also loaded in other contexts, the Texture2D name is not updated to the correct relative path or name as defined by the particle texture region.

For example, consider the case where the particle is at ./particles/particle.ember and has a relative path to the texture at ../maps/tiles.png. Since MGCB caches resources, if the game loads the texture2D in a different context, the name of the texture will not be relative to the particle as it should be for the particle to load it correctly.

In my case, this is fully solved by removing the non-null check that exists before assigning the name of the particle's texture.

Steps to Reproduce

  • Create a particle effect that uses a texture that is not immediately local to the saved ember particle file
  • Load the particle effect at runtime
  • Load the same texture as a Texture2D from a different path in a different context. This will update the name of the Texture2D.
  • Load the particle effect a second time--the name will not be updated due to the null check

Expected Behavior

The particle effect should load as expected by updating the texture.Name to be the same as the Texture2DRegion.Texture.Name from the particle effect.

Actual Behavior

Microsoft.Xna.Framework.Content.ContentLoadException: 'The content file was not found.'

Configuration

MGEX 6.0.1

Other Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions