Skip to content

Commit 18896a6

Browse files
Fix incorrect condition for GPUEvent
Mistake introduced at #4457
1 parent a0b5bdc commit 18896a6

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

TestProjects/VisualEffectGraph_HDRP/Assets/AllTests/Editor/Tests/VFXContextTests.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,14 @@ public void Link_Fail_From_Event_To_OutputEvent()
203203
Assert.IsFalse(VFXContext.CanLink(from, to));
204204
}
205205

206+
[Test]
207+
public void Link_Fail_From_GPUEvent_To_Spawn()
208+
{
209+
var from = ScriptableObject.CreateInstance<VFXBasicGPUEvent>();
210+
var to = ScriptableObject.CreateInstance<VFXBasicSpawner>();
211+
Assert.IsFalse(VFXContext.CanLink(from, to));
212+
}
213+
206214
[Test]
207215
public void MultiLink_Spawn_And_Event_To_Initialize()
208216
{

com.unity.visualeffectgraph/Editor/Models/Contexts/VFXContext.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,8 +260,8 @@ public static bool CanLink(VFXContext from, VFXContext to, int fromIndex = 0, in
260260
to.m_InputFlowSlot[toIndex].link.Any(o => o.context == from && o.slotIndex == fromIndex))
261261
return false;
262262

263-
//Special incorrect case, GPUEvent use the same type than Spawner which leads to an unexpected allowed link.
264-
if (from.m_ContextType == VFXContextType.SpawnerGPU && to.m_ContextType == VFXContextType.OutputEvent)
263+
//Special incorrect case, GPUEvent use the same type than Spawner which leads to an unexpected allowed link on output & spawner.
264+
if (from.m_ContextType == VFXContextType.SpawnerGPU && to.m_ContextType != VFXContextType.Init)
265265
return false;
266266

267267
//Can't connect directly event to context to OutputEvent

0 commit comments

Comments
 (0)