Casting Interface to Pawn subclass in Blueprint causes massive crash
So I guess that Interfaces aren't supposed to be cast-able? I don't know. That doesn't make sense to me, but based on what it takes to repro this, I'm assuming that's the case.
Approximate Repro: Make Blueprint Interface (IHero we'll call this) Make player pawn that implements above interface (we'll call it Hero)
Make a new blueprint, (TestCrash in this case)
In TestCrash make a variable, "HeroInterface" that is of type IHero.
In Event Graph, make a [Event Begin Play] node. Drag [Get HeroInterface] onto the graph.
(This is the part that leads me to believe interfaces aren't supposed to be cast-able.) Make a [Get Player Pawn] node. Drag the Pawn pin to make a [Cast to Hero] node. Delete [Get Player Pawn], and connect [Cast to Hero] to [Event Begin Play] so that you have [Event Begin Play] -- [Cast to Hero]
Connect HeroInterface to Object pin on [Cast to Hero]. Hit save, then hit compile.
Expected Result: Probably some kind of error? Personally, my expect result is that it works, because why shouldn't it?
Actual Result: A crash so hard it will bruise your mother. Not only does it crash the Editor, but if the editor wants to open that blueprint on load, it will crash on project load. If you open the Editor then drag the Blueprint into the folder via Windows Explorer, if you attempt to open the blueprint it will crash again. So the only way to fix this problem is to delete or otherwise get rid of the blueprint and start over with it. Which is, you know, inconvenient.
I should mention as well that I did not actually repro this from a new scratch project. If you can't repro, let me know and I will try from scratch.
asked Oct 15 '14 at 10:44 PM in Bug Reports
I was able to reproduce this issue and have entered a bug report for the developers to look over (TTP# 349716).
The cause is the attempt to Cast to a Blueprint off of a Interface variable that shouldn't be able to accept Interface. The bug is that what you're attempting to cast to shouldn't be able to accept the interface variable as an input at all. Can you explain what you're attempting to do with the interface? Interfaces allow you to communicate between blueprints, so if both your TestCrash BP and your Hero BP use the IHero interface, you shouldn't need to cast to the character at all. If you do prefer to cast to the character, you can do so using the Get Player Pawn or similar references, rather than use a reference to the interface, which is not a parent of the pawn.
You can read more about interfaces here:
Let me know what setup you're looking to achieve and I'll try to show you how to do it.
answered Oct 16 '14 at 06:38 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here