Find Component

Unreal 
APlayerChar::APlayerChar()
{
  // Set this character to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;

                //UStaticMeshComponent* ObstacleMesh = Cast<UStaticMeshComponent>(GetDefaultSubobjectByName(TEXT("Obstacle Mesh")));//Remember : Name was match with Blueprint otherwise crash ue4
//but Error When Use this Function like ObstacleMesh->SetHiddenInGame(true);
                USkeletalMeshComponent* PlayerMesh = GetPawn()->FindComponentByClass<USkeletalMeshComponent>();
                UCapsuleComponent* plyrCapsul = this->GetCapsuleComponent();
}
Unity
[SerializeField] CapsuleCollider plyrCapsul;
void Start() => plyrCapsul = this.gameObject.GetComponent<CapsuleCollider>();

Comments

Popular posts from this blog

Play Sound

Open Level

UI & Widgets