简体   繁体   中英

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:

在此处输入图片说明 在此处输入图片说明

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

unfortunately the context is not very clear. but i don't think casting works in this case. Try with:

One Item More items in Scene

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM