Get the pointer to a player in the gamemode class
I'm trying to access the custom character that I dragged and dropped into the level. How exactly can I get a pointer to that? Also as a bonus question, when I remove my character from the level and just assign the
asked Feb 09 '19 at 12:41 AM in C++ Programming
I guess this gonnan be helpful for you, majority of nodes you see in Blueprints are direct buindings of C++ class, some of htem are specially made for blueprint use and they are gethered in UBlueprintFunctionLibrary based classes, one you probably will most useful is UGameplayStatics
Even thru they made for blueprint, you can still use them in C++, it will be probably help transition. And don't worry if you call those via C++ they are not bound to blueprint lower perfromance, but some functions are not optimized like for example GetAllActorsOfClass, in C++ insted you can use TActorIterator which allows you to break the search loop if you find actors you looking for and save up CPU time, while that function will loop to the end to create resulting array.
There one that you look for:
WorldContextObject is object in perticilae world, so all you need to is deliver any actor pointer to it, if you already in actor just use this.
But normaly in C++ you should get playerconteroller and from that possessed pawn and in single player form actor you can do this
Follow this question
Once you sign in you will be able to subscribe for any updates here