Download

Why is my function returning a different object type?

I have a function, with a single OUT variable of type Tile (which UE4 calls Tile_C).

The function iterates through any hit results from a line trace, attempts to cast any hit actors to Tile, and if successful returns the reference.

However the type of the returned object is SKEL_Tile_C. So I’m forced to re-cast it to the right type again in order to make use of it (attempts to link it up to anything expecting an object of type Tile fail).

Can someone please explain why my function is not returning the specified type despite casting to that type right before the return node? Am I doing something wrong?

Also, on a related note, I can no longer find the “Cast to …” nodes. They seem to have completely disappeared from the list of available nodes, with or without “Context Sensitive” enabled :frowning:

The _C means it is blueprint class.

For the casting issue, I’m not sure though. What is the type of the return variable? It may be getting cast on return.

I think he mean why it becomes SKEL_ prefixed. I think James would have a better answer if he saw this.

Yeah that’s the question. The function has a type Tile_C return variable, the script casts to type Tile_C and yet the actual returned object is type SKEL_Tile_C and I have to re-cast it to avoid type mismatches.

That might be a bug. You should submit it on AnserHub

Okay I will do.

Anytime you see SKEL_ then that is a bug :frowning: That is what we call a ‘skeleton’ class which is an internal construct you should never see. We’ll look into this issue, if you have a repro please do post to Answer Hub, that would really help us track it down.

Thanks for the reply, James! I assume ‘repro’ means instructions to reproduce? Is there some way I can send you a blueprint file? It’s all contained in one blueprint class.

Sorry, yes, ‘repro’ = reproduction steps! You should be able to attach the problem blueprint to the Answer Hub question. Thanks for your help.