Change URPMaterialPropertyBaseColor not work

Hi!

I have a small piece of code here which should change the BaseColor:

            DynamicBuffer<LinkedEntityGroup> childs = SystemAPI.GetBuffer<LinkedEntityGroup>(_buildingSelectEntity);
            foreach(LinkedEntityGroup child in childs){               
                Entity childEntity = child.Value;
                if(SystemAPI.HasComponent<URPMaterialPropertyBaseColor>(childEntity)) {
                    Debug.Log("Set to green!");
                    _commandBuffer.SetComponent(childEntity, new URPMaterialPropertyBaseColor {
                        Value = new float4(0.1f, 0.65f, 0, 1f)
                    });
                }               
            }

            _commandBuffer.Playback(EntityManager);

This component is on the children:

#if URP_10_0_0_OR_NEWER
using Unity.Entities;
using Unity.Mathematics;

namespace Unity.Rendering
{
    [MaterialProperty("_BaseColor")]
    public struct URPMaterialPropertyBaseColor : IComponentData
    {
        public float4 Value;
    }

    [UnityEngine.DisallowMultipleComponent]
    public class URPMaterialPropertyBaseColorAuthoring : UnityEngine.MonoBehaviour
    {
        [Unity.Entities.RegisterBinding(typeof(URPMaterialPropertyBaseColor), nameof(URPMaterialPropertyBaseColor.Value))]
        public UnityEngine.Color color;

        class URPMaterialPropertyBaseColorBaker : Unity.Entities.Baker<URPMaterialPropertyBaseColorAuthoring>
        {
            public override void Bake(URPMaterialPropertyBaseColorAuthoring authoring)
            {
                Unity.Rendering.URPMaterialPropertyBaseColor component = default(Unity.Rendering.URPMaterialPropertyBaseColor);
                float4 colorValues;
                colorValues.x = authoring.color.linear.r;
                colorValues.y = authoring.color.linear.g;
                colorValues.z = authoring.color.linear.b;
                colorValues.w = authoring.color.linear.a;
                component.Value = colorValues;
                var entity = GetEntity(TransformUsageFlags.Renderable);
                AddComponent(entity, component);
            }
        }
    }
}
#endif

And this is my shader:


The code from me is executed, but the color does not change. According to the script, ‘_BaseColor’ is accessed in the ‘URPMaterialPropertyBaseColor’. This is exactly what I have. However, the color does not change.

Does anyone see where the error is?

That “Override Property Declaration” on the right needs to be checked, and you will find an option you’ll need to set to make things work.

Thank you very much, is set. Unfortunately, it still does not work. I have also activated the override in the graph settings. But that doesn’t help either.

Did you save your graph?

Unfortunately, I would need more information about what you have, and what behavior you are getting to provide any further suggestions.

I have attached the shader for you. If you feel like it, you can have a look at it. It’s easier than taking 100 screenshots.^^

9731992–1391713–SelectOutlineUnlit.7z (5.29 KB)

Small mistake, big effect!

Property in the code: _baseColor

Property in the shader: _base_Color