castingdefault-valueunreal-engine4object-referenceunreal-blueprint

How to cast an Object Reference in Unreal Engine 4?


I want to reference an asset from another Blueprint to trigger an event from that.

I have a variable with Object Reference type, and I set its default value to the particular asset I'm interested in.

When it comes to action, I call a Cast node with the variable as an input, but the casting always fails. I cannot understand it at all, because I thought that due to the default value it is already in the correct type.

What am I doing wrong?

Here are some image of the problem:

enter image description here enter image description here

The OnMessageReceived event is triggered correctly, then I see the second ("Unsuccessful cast...") message on screen.


Solution

  • Finally I have found the solution. The problem was not with the casting but with the place of setting it's default value.

    I moved that part to the level blueprint and now it is working.