From f6518e10e13c699975f5cac4d51d53eb5b51fd38 Mon Sep 17 00:00:00 2001 From: Gabriel de la Cruz Date: Mon, 1 Jul 2024 17:32:06 +0000 Subject: [PATCH] [VFX] Fix SpawnIndex attribute when using instancing We are storing the wrong value for SpawnIndex attribute during Init compute, when processing several instances at the same time. We are currently using the batch thread index, instead of per instance thread index. The fix is very simple, just replacing one with the other when storing the value. --- Packages/com.unity.visualeffectgraph/Shaders/VFXInit.template | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Packages/com.unity.visualeffectgraph/Shaders/VFXInit.template b/Packages/com.unity.visualeffectgraph/Shaders/VFXInit.template index 51404b57c3f..3a0a92274cb 100644 --- a/Packages/com.unity.visualeffectgraph/Shaders/VFXInit.template +++ b/Packages/com.unity.visualeffectgraph/Shaders/VFXInit.template @@ -138,7 +138,7 @@ void CSMain(uint3 groupId : SV_GroupID, attributes.seed = WangHash(particleIndex ^ systemSeed); #endif #if VFX_USE_SPAWNINDEX_CURRENT - attributes.spawnIndex = id; + attributes.spawnIndex = index; #endif #if VFX_USE_SPAWNER_FROM_GPU && VFX_USE_SPAWNCOUNT_SOURCE