Spawn Actor return value not compatible with Actor Reference?

Hello,

I’m trying to assign the return value of a spawn actor node to its reference but this doesnt seem to work unless I’ve explicitly said which class the spawn actor node is to use. Is there a reason I can’t do this on the fly?

03c3fb92565e157e9ee23e869357fdb48af7f048.jpeg
d28a459c5533ca5de3d3e220d6356eb763ecb869.jpeg

The following works fine but these are explicit.

571769098daeef4f67b0776428cdfc8a35a283f1.jpeg

Just cast the reference to your type before you set it to a variable.

The reason you can’t do this on the fly is that the SpawnActor node is using a dynamic class, meaning that the return type could change at any given time, which would stop you from setting the variable. You’ll need to cast to each possibility of class that it can be, and set it from the cast return value.