how to repeat code in Function for different things

If the current index is 1 or 2, do the same thing, but spawnBP_Straight1 and BP_Straight2 respectively.


How would I go about doing that?

Use a Switch (INT) to set a function local var for the class to spawn.

Sequence Node
Then 0 β†’ Switch on INT β†’ Set class
Then 2 β†’ Spawn actor

2 Likes



The thing I am trying to do is use the array to spawn tracks sections from the blueprint using Spawn actor BP_Straight 0,1 and 2. it has to be in the same function and I’m wondering on what to do so that it works

Hey @MARZ64331

does this work?

That is what @Rev0verDrive mentioned

1 Like

It does not work.

Hey @MARZ64331

Can you show what you have done so far? Do you change the Transform so they are not spawned inside of each other? Don’t use the IsValidClass and Branch for testing and select the classes inside the Switch without an extra variable. You can also add a PrintString in different points of the execution to show you which code gets executed and which not