I think in UE, class constructor is called after every compile. In your constructor you have:
SkeletalMesh(nullptr);
so maybe this is resetting the value.
Maybe just use:
USkeletalMesh* SkeletalMesh = nullptr;
and remove that line from constructor.