Recently had the task of refactoring a system to ECS and currently trying to convert a regular feature that changes a shader's property per instance. I'm aware of the whole setup with MaterialProperty, but for some reason, while the component values do change, the properties do not, so I set a simpler example with cubes and a basic shader with only a _Color property such that:
[MaterialProperty("_Color")]
public struct MaterialOverrideTest : IComponentData {
public float4 Value;
}```
Where the _Color property reference has been set to Hybrid Per Instance and the shader itself set to allow material overrides.
and a simple system:
```csharp
public partial class CubeColorSystem : SystemBase {
protected override void OnUpdate() =>
Entities.WithAll<MaterialOverrideTest>()
.ForEach((ref MaterialOverrideTest materialOverrideTest) => {
var time = (float)SystemAPI.Time.ElapsedTime;
materialOverrideTest.Value = new float4(math.sin(time), math.cos(time), 0, 1);
}).ScheduleParallel();
}```
And the ``MaterialOverrideTest `` component values do change as expected, yet the materials are unchanged.
I'm wondering if I'm missing anything here. Tested on 2022.3 and 2023.2.