Material Overrides in 2023.1.0b1

Hello dear Unity developers,

I can’t get Material Overrides to work in 2023.1.0a is it me or it’s normal?
I’m using Entites 1.0.0-pre.15 and Entites Graphics 1.0.0-pre.15 in a new virgin project.

I use this script to test my material:

using Unity.Entities;
using Unity.Rendering;
using Unity.Transforms;
using UnityEngine;
using UnityEngine.Rendering;

public class Tester : MonoBehaviour
{
    EntityManager entityManager;

    public Mesh     mesh;
    public Material material;

    RenderMeshDescription renderMeshDescription = new(
        shadowCastingMode: ShadowCastingMode.Off,
        receiveShadows: false);

    void Start()
    {
        entityManager = World.DefaultGameObjectInjectionWorld.EntityManager;


        EntityArchetype mainArchetype = entityManager.CreateArchetype(
            typeof(LocalTransform),
            typeof(LocalToWorld),
            typeof(TestoverOverride),
            typeof(RenderMeshArray),
            typeof(RenderBounds));

        Entity entityParent = entityManager.CreateEntity(mainArchetype);

        RenderMeshUtility.AddComponents(
            entityParent,
            entityManager,
            renderMeshDescription,
            new(new[] { material }, new[] { mesh }),
            MaterialMeshInfo.FromRenderMeshArrayIndices(0, 0));

        entityManager.SetComponentData(entityParent, new LocalTransform
        {
            Scale = 1
        });

        entityManager.SetComponentData(entityParent, new TestoverOverride
        {
            value = 1,
        });
    }
}

[MaterialProperty("Testover")]
public struct TestoverOverride : IComponentData
{
    public float value;
}


public partial class TestoverSystem : SystemBase
{
    protected override void OnUpdate()
    {
        Entities
            .ForEach((ref TestoverOverride maturityOverride) => { maturityOverride.value = 1000; })
            .ScheduleParallel();
    }
}

And this my shader.

I don’t understand what’s wrong. That’s worked well in Unity 2022 with Entites 1.0.0-pre.12
How can I fix this?

Thank you for your help!

I’ve run into a similar problem updating to 2022.2.2f1 today, instanced properties no longer work on entities (possibly child entities, still debugging).

It worked in 2022.2.1f1 and before.

Edit: Confirmed it still works ind 2022.2.1, but not in 2022.2.2

1 Like

Wonderful! the bug is solved in 2023.1.a25

Thank you!

Unfortunately, it only worked in the editor, not when the game is build… :frowning:
(2023.1.0.b1)

100000001218704--1121384--clear.png

2023.1.x does not support Entities package yet. Use Entities/DOTS with 2022.2 only for now.

1 Like

Hooray! It’s work in editor and build on 2023.1.0b3 :slight_smile:

Glad to here it!