#My resources share one field seemingly globally (.NET godot preview 4.4dev6)

1 messages · Page 1 of 1 (latest)

minor sphinx
#

i have a few fields in a class extending Resource:

        [Export] public bool ShowDamageVisuals { get; set; } = true;

        [Export] public string Id { get; set; }

        [Export] public GradientTexture1D DetroyParticlesColor { get; set; }

        [Export] public float DestroyParticlesScale { get; set; } = 1.0f;

Everything works fine, except for DetroyParticlesColor, which gets stuck as the colors of one of my resource instances.

I use that field here at _Ready, where ObstacleData is a saved resource with data:

            breakingParticles = GetNode<GpuParticles2D>("BreakingParticles");
            var mat = breakingParticles.ProcessMaterial as ParticleProcessMaterial;
            mat.ColorInitialRamp = ObstacleData.DetroyParticlesColor;
            breakingParticles.Scale *= ObstacleData.DestroyParticlesScale;

the scale is correct, the colors are not. currently all my particles are orange like a braziers particles.
I already tried to "Make Unique" for all fields, for this one field, no change. There are other reference type fields like texture and audiostreams, and those are all good too.

what am i missing here?

#

breakpointing at assignment, that is the blue debug color for the barrel i set. yet it renders orange

#

sort of solved but still confused.
it wasn't enough to make unique in my original scene, i have to go in to the scenes using them, toggle editable children, and set "make unique" for each instance individually. there has to be a better way

minor sphinx
#

i will mark this as solved, never quite figured out how to do this actually correctly but at least it works

plain heron
#

also note that if you want it to work for a sub-resource like a gradient texture, both it and the main resource have to be set to local_to_scene.