Set Instigator when spawning actor with variable

Hello,

I want to spawn an actor with a Class variable, so I can spawn different actors with the same code. But when I use the variable, the Instigator input doesn’t show up in the spawn node. When I put the class manually in the class input (as seen in the second node) the instigator input does show up, while both classes are the same.

See also this picture:
instigator.png

My question is why doesnt this work?

Most likely either a current or absolute limitation of that function. If you assign a class manually then attach a class variable the instigator pin stays - but for how long I do not know.

If you try to attach the variable first then it won’t be there. Purely, from my understanding, because the variable can be changed at any time, so the pins for input may not always be available - this very easily leads to things breaking quickly.

Where as if you set the class in that node itself, then you’re explicity designating that node to that class so it can guarantee those pins will always be there. As I said, it’s most likely just a limitation.

My advice, if you want that pin, use multiple spawn actor from class nodes each explicitly specifying the class you’re trying to spawn and use a switching system to spawn things. This can be done very easily with Switch on String or Switch in Integer, or any other custom way of going about it with a branch chain.

-WM

Thanks! I found out that when you manually set it and then connect the variable pin to it, it works the first time in the editor, but the second time it doesn’t work anymore and the instigator input has disappeared.

Switch on int, will work but I use it to spawn different dino’s for my mod, and I need to set variable to use in the construction scrip. I thought this was the only way, but correct me if I am wrong. The problem is I have over 40 different dino’s which can be spawned and creating a seperate node for every one will take a long time and it is confusing.