in the Headerfile of another class. This is working and a can see the Variable in the blueprint, but how can i get the character in the .cpp file? In blueprints there is a function called “Get Player Character” which can be cast to the specific character class. But i can’t find that in c++.
Ok, after googling half of the WWW i found out how to get the character
for (TActorIterator<AActor> ActorItr(GetWorld()); ActorItr; ++ActorItr)
{
MyCharacter = Cast<ASurvivalCharacter>(*ActorItr);
}
MyCharacter is the one i created in the header.
It also works with ->Role to check if its the server or the client. Took me some time to test, but changing a variable on both depending on server or client showed me that it is working (i hope x))