ACharacter::GetMesh
#include "GameFramework/Character.h"
Access: public
Specifiers: inlineconst
Description
Returns the character's skeletal mesh component (the Mesh subobject). Use this to access the mesh for animation, socket queries, material changes, or attachment.
Caveats & Gotchas
- • Returns the pointer directly without null-checking. In rare edge cases (e.g., if the component was explicitly destroyed at runtime), the pointer can be null — guard with a null check when calling from code paths that may run on partially initialised actors.
- • The returned component is the root visual mesh, not the capsule. Collision queries should use the CapsuleComponent; visual attachment, sockets, and animation state belong on this mesh.
Signature
inline class USkeletalMeshComponent* GetMesh() const Return Type
USkeletalMeshComponent* Example
Playing a montage on the character mesh C++
UAnimInstance* AnimInstance = GetMesh()->GetAnimInstance();
if (AnimInstance && HitReactMontage)
{
AnimInstance->Montage_Play(HitReactMontage);
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?