How to cast( boxing, unboxing ) values ?

Hi,

is there boxing/unboxing in UE and blueprint like in C# where i can cast let’s say an int, struct or float to an object to pass it to a function ?

I’m having a base class widget and a couple of child widgets of the base. I would like to be able to create an “Initialize” function that takes that object as input parameter. Then each one of the children widget should override the Initialize function and try to cast that in object param to specific class type. Is that possible in UE as i’ve done this a lot in Unity and C# ?

You can only cast one thing to another, if they are indeed related.

In your example, pass an ‘actor reference’ to the function. That lets you pass just about anything, which can be cast later on into what you actually passed.

1 Like

I see, thanks for the tip !

1 Like