I have functions like this in multiple blueprints where I need various references cached - player controller, game instance etc, and they work fine, but I got tired of constantly copy pasting them so I figured a function library could help.
I made 2 functions for fetching the game instance and an AI base and they're working. All they do is check if the value is null, and if it is do a cast, otherwise return it as is. Lazy loading I guess. However when I try to do the same for the player controller, the cast always fails, so it keeps returning null. Trying to understand why the others work but the PC fails to cast inside the function library.
- 1st image is the old, local function which casts fine, 2nd is from the library, which fails;
This Calleris just a reference toSelf, which I'm not sure is even needed, if they work they work without it as well, just figured it doesn't hurt to have it;