Spawn Actor return value not compatible with Actor Reference?


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?


The following works fine but these are explicit.


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.