I am having a bit of an issue with Skeletal Meshes when using C++. Basically, I am noticing that whenever I try to access GetBodyInstance() in a Skeletal Mesh, it crashes the editor.
Here is an example line of code:
myMeshActor->GetBodyInstance()->bLockYTranslation = 1;
That line is inside a function that gets called by blueprint and it instantly crashes the editor. Anything I try to access in GetBodyInstance() crashes the editor. Both Visual Studio and Xcode compile it just fine.
Here is some example code I made to try solving this:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = “Meshes”)
USkeletalMeshComponent* myMeshActor = CreateDefaultSubobject<USkeletalMeshComponent>(TEXT(“My_Mesh”));
UFUNCTION(BlueprintCallable, Category = “Testing”)
static ConstructorHelpers::FObjectFinder<USkeletalMesh> myMeshActor_Visual(TEXT("/Game/Meshes/myMesh"));
myMeshActor->GetBodyInstance()->bLockYTranslation = 1; //This causes crash
Any idea if I am trying to access it wrong?
I have also tested this issue with a Static Mesh and that does NOT cause a crash. No idea why. Thank you in advance.