Sprite rendering system for preview 30

Anyone has working sprite rendering system for the latest API version? I used to use this one, but it’s way outdated.

1 Like

We’ve used ECS for a while at preview 24, but after upgrade to preview 30, lots of API changed and our sprite animation rendering system can not ported. is there any plan to support MaterialPropertyBlock in RenderMeshSystem? Or have a callback after culling and batching, like:

// T is used to select entities has a custom component of type T, and Action is used to fill the MaterialPropertyBlock according to NativeArray, maybe a trunk or a batch
RenderMeshSystemV2<T, Action<MaterialPropertyBlock, NativeArray>> where T : struct, IComponentData
{

m_DynamicGroup = GetEntityQuery(…, ComponentType.ReadOnly();
//…
// pass the callback to InstancedRenderMeshBatchGroup, and call it before matrix data is filled.
m_InstancedRenderMeshBatchGroup.AddBatch(tag, rendererSharedComponentIndex, instanceCount, chunks, sortedChunkIndices, startSortedIndex, batchChunkCount, flippedWinding, editorRenderData, callback);
}

I have try this impl but two problems:
1.
after I copy RenderMeshSystemV2.cs and rename to CustomRenderMeshSystemV2.cs and modified all the name inside accordingly, unity editor will crash after hit play. (how can i debug it or what should i do?)

doest ComponentSystem support template? like I wrote before.

Old method, with DrawMeshInstanced must works very well. I managed to create two rendering systems fully independent to Hybrid Renderer with DrawMeshInstanced in last ECS version on 2019.1. So I think custom sprite renderer with DrawMeshInstanced also posible.
Also I managed to inject MaterialPropertyBlock to BatchRendererGroup in HybridRenderer, but it doesn’t work properly, because of complexity of HybridRenderer. It is more complicated than just inject MaterialPropertyBlock to AddBatch, internaly maybe there are some reversing, or something like that, so all instanced array data must be reversed by chunk. Also there are some sort of caching, that breaks all straightforward injection of instanced data. And important for me negative factor is limitation of map size and camera movement speed.