#MaterialProperty component on multiple submeshes.

1 messages · Page 1 of 1 (latest)

jagged sluice
#

How do i use the [MaterialProperty] component on a GameObject/Entity with more than 1 submesh?

#

How do i bake this? is there a way to add this component on every additional entity?

elfin perch
#

You can bake using baking systems

#

find all relevant entities and give them all proper components

#

Not a lot of people work with submeshes anyway, can't you just bake it as separate children?

jagged sluice
#

No, it is not my asset

#

But how do i find all relevant entities in a baking?

#

It is an asset from asset store

elfin perch
#

well, first - try to take a look at result of baking in hierarchy inspector

#

maybe it'll be clear enough

jagged sluice
#

this is how it looks like

#

But i can`t get this entities on a baker

#

can i?

#

there is only this

jagged sluice
#

Is it even possible with a system adding it at runtime?

jagged sluice
#
[WithNone((typeof(MaterialMeshInfo)))]
public partial struct AddIsometricCullOnHierarchiesJob : IJobEntity
{
    public EntityCommandBuffer CommandBuffer;

    [BurstCompile(CompileSynchronously = true)]
    public void Execute(in DynamicBuffer<Child> child, in IsometricCullComponent cull, Entity e)
    {
        CommandBuffer.RemoveComponent<IsometricCullComponent>(e);
        CommandBuffer.RemoveComponent<MaterialOpacityComponent>(e);

        for (int it = 0; it < child.Length; ++it)
        {
            CommandBuffer.AddComponent(child[it].Value, cull);
            CommandBuffer.AddComponent(child[it].Value, new MaterialOpacityComponent() { Value = 1.0f });
        }
    }
}```
#

i tried this but they are not Child ;c

elfin perch
#

are they even children?

#

this looks like some custom buffer

jagged sluice
#

How can i know this?

jagged sluice
#

Nothing works, not even LinkedEntityGroup