What are the reasons for a cast to fail?

"What are the reasons for a cast to fail? I can only imagine two situations:

  1. When the object is not of that type (nor any of its parents).
  2. When the object is null.

Is there any other reason that I might be unaware of?

I ask this because in a game I’m developing, the cast succeeds in Play in Editor (PIE) mode, but fails when running in Standalone mode … =P"

Afaik there shouldn’t be anything else that could go wrong when casting. In standalone mode, did you check the object is valid? I remember I experienced a similar issue when I forgot to mark a property using the UPROPERTY macro in a C++ class. In PIE everything was fine, but in standalone the object was garbage collected because of the missing marker.

Sounds like the issue is in the order they are added to the world. More info is needed.

Hi pladux.

I’m working only with blueprints. How can i check that?

What kind of information do you need? Could you help me with that? Thank you.

If working with blueprints only that definitely shouldn’t be a problem.

  • Is it happening as soon as the game starts?
  • how are you getting the references?
  • can you show the BP with the cast?