I created a new c++ third person project and in the character’s tick-function I put this:
UClass *test = GetClass();
test->GetDefaultObject<ATestProjectCharacter>()->Testfunction();
Doesn’t make too much sense, but for testing-purposes it shouldn’t make a difference, if there already is an instance I could use, I assume.
This is the declaration of TestFunction()
UFUNCTION(BlueprintImplementableEvent, Category = test)
void Testfunction();
This is the Graph of the Character in the editor
http://puu.sh/cYMBB/71318997eb.png
starting the game results in a crash. It is caused by the GetPlayerCharacter. GetAllActorsOfClass also causes it. I assume everything refering to instances in the level somehow does. Just printing a normal string works though.
I assume I just don’t know something about the DefaultObject. It would be really helpful if someone could point out why this happens.