x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

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.

Product Version: Not Selected
Tags:
more ▼

asked Oct 15 '14 at 10:44 PM in Bug Reports

avatar image

apollyonbob
53 2 70 12

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

Hey apollyonbob,

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:

https://docs.unrealengine.com/latest/INT/Engine/Blueprints/UserGuide/Types/Interface/index.html

Let me know what setup you're looking to achieve and I'll try to show you how to do it.

more ▼

answered Oct 16 '14 at 06:38 PM

avatar image apollyonbob Oct 17 '14 at 07:12 PM

Oh I was doing bad things haha. I appreciate the thought though! To explain briefly, I had originally passed an interface instead of the entire hero because I thought all I needed was the interface. I cast the Interface back to the Hero on the other side basically because I was being a little lazy before going back and changing the interface. I ended up doing things a lot different in the end.

It was the catastrophic crash and inability to open the project that I wanted to call attention to haha.

Also yes, I mean, I realize I mentioned that I would expect that to work, but that was definitely the programmer side of me. The architect side of me says that it shouldn't ever be done - and I had no intention of keeping the code that way. But I guess I figured with the "Cast Failed" pin you guys were already taking bad casts into account. The difficulty in getting the cast node to begin with should've been a warning sign haha, but I'm still figuring Blueprints out.

Thanks for the response though! Appreciate it.

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question