Object class cast to Actor class always fails, why?
I have a blueprint with parent class Actor (BombComponent in the attached image). I can get its Class object with a Get Class call, but it returns an Object Class. I want to cast this to an Actor Class so I can use that with a SpawnActor node to spawn it (SpawnActor only accepts Actor Class, not Object Class).
This cast always fails. What am I misunderstanding?
asked Jan 24 '15 at 10:29 PM in Blueprint Scripting
When you "Spawn Actor", are you able to select the blueprint in the drop down?
answered Jan 25 '15 at 02:29 PM
Thanks for the detailed explanation , before I saw your reply I created a basic example of a "spawn system" which is not "hard coded" as you described above.Which I will post , hopefully you find it interesting ,its not a "how-to" but more just a basic explanation , as there is almost always more than one way of doing something , depending on your needs.I'm not sure how experienced you are with Blueprint Scripting , so forgive me If my explanation is too/less informative. I'll read you're explanation through another time and see If I can provide you with an additional solution/explanation. System created was tested and works as expected. Just another important question.You are referring to components of "A Bomb"(yours in this case) and not components in Blueprints that makes up a Blueprint right? Hope this sheds a little more light.
I ran into the same issue, and ended up needing to just create a temporary variable for the Actor Class I wanted to select and using a Set node with the drop down selected, instead of the drop down on the Get Class node. Ultimately simpler from a blueprint point of view anyway, since it reduces the number of nodes (no casting required).
Looks like @Ockertvs used a similar solution, although he's just using a true/false branch instead of a Switch To (+ Enum in my case) node to select from a larger list of Actor Classes.
answered May 26 '17 at 02:24 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here