Making pure function inside of a macro causes problems and won't be packed.

I’m using UE4.5.
I’ve made some macros to make it easier to access my character, controller and HUD blueprint so i won’t have to reassign them every time i make a new blueprint.
It work’s good but the fact the each time i starts the editor and want to start the game for the first time, it gave me this message :

One or more blueprints has an unresolved compiler error, are you sure you want to Play in Editor?
BP name  
Bp name2

For each blueprint that uses this kind of macros.
After i play once, and the screen graphics get messed a little, i stop the game, pressing play again, and everything is seems to go well like there was never a problem.
Also my game is fail to pack, i don’t know yet if this is the cause of the problem, but i’m pretty sure it is.

This is the Macro style :

Your problem is that you are making a non-pure function into a function. Cast requires an execution and therefore cannot be a pure function.

It works in the editor, if it wasn’t supposed to work it wouldn’t work anywhere…

If only that were true…

I’v just checked it and when i’m using only the pure function without the macro it works good. something is going wrong when i put it inside a macro. so i just have to use 2 nodes instead of one.
It seems like a bug because the pure function working great by it’s own.

I don’t think your problem is because you are casting in a pure function. A pure function just means that it will not change the state or members of the class.

However I have just tried reproducing the function and macro you are having trouble with, and in the editor it works fine. Even restarting the editor produces no problems. I haven’t tried packing it though. So not sure what is happening for you. What else are you doing in those blueprints? Or with the return value of the macro?

Anyway if you say that it works for you without it being in a macro, why not just move the “Get player character” node into the function. I tried that and it also worked without any problems. So then you are back down to one node, that being just the function.

Because of the fact that the macro is based on the “Actor” class blueprint and a function doesn’t depend on anything, It gave me problems while i’v tried to insert there some of those getters, but if you say it work’s for you, perhaps i should try again, maybe i did something wrong, Thanks for the advice!