Class Member is NULL when accessing a function from Blueprint

Hi there guys,

just some pseudo code to explain the issue:



MyClass.cpp:

MyClass::BeginPlay()
{
  SpawnedActor = (ASpawnedActor*) GetWorld()->SpawnActor( ASpawnedActor::StaticClass(), Location );
}


void MyClass::v_CalledFromBlueprint()
{
  SpawnedActor->Move();
}



Now the issue is that the SpawnedActor is not valid in the function MyClass::v_CalledFromBlueprint().
It’s valid when i log it in OnTick but somehow null when the function v_CalledFromBlueprint is executed.

Just some background info:

I’ve set up a UMG-Widget for EdgeScrolling, once the mouse is over the UMG i call MyClass::v_CalledFromBlueprint() with the enum of the widget under the cursor.
In the function v_CalledFromBlueprint() i’ like to the execute the Move Function which is implemented inside a MovementComponent of MyClass.

Does anyone have a clue why the spawned Actor is not valid inside the BlueprintCallable function?

Edit: Added tags

Solved!

I removed the static specifier for the v_CalledFromBlueprint() Method and that botched something in the event graph.
Afterwards i added the SpawnedActor as a parameter of the v_CalledFromBlueprint and edited the blueprint.
Now the pointer is valid.