Skip to content

Commit f6518e1

Browse files
gabrieldelacruzEvergreen
authored and
Evergreen
committed
[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.
1 parent 206c513 commit f6518e1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Packages/com.unity.visualeffectgraph/Shaders/VFXInit.template

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ void CSMain(uint3 groupId : SV_GroupID,
138138
attributes.seed = WangHash(particleIndex ^ systemSeed);
139139
#endif
140140
#if VFX_USE_SPAWNINDEX_CURRENT
141-
attributes.spawnIndex = id;
141+
attributes.spawnIndex = index;
142142
#endif
143143

144144
#if VFX_USE_SPAWNER_FROM_GPU && VFX_USE_SPAWNCOUNT_SOURCE

0 commit comments

Comments
 (0)