Posts

Open Level

Unreal void APlayerChar::SwitchLevel() { class UGameplayStatics::OpenLevel(this, TEXT("NewLevel")); }//#include "Kismet/GameplayStatics.h"  Unity void SwitchLevel() => SceneManager.LoadScene(1);//using UnityEngine.SceneManagement; 

UI & Widgets

 Unreal virtual void NativeConstruct() override; bool UTestWidget::Initialize() { MyTextBlock_Name->SetText(FText::FromName("Player"));//UPROPERTY(BlueprintReadWrite, meta = (BindWidget)) class UTextBlock* MyTextBlock_Name;                  return true; } void UTestWidget::NativeConstruct() { MyButton->OnClicked.AddDynamic(this, &UTestWidget::GamePause);//UPROPERTY(BlueprintReadWrite, meta = (BindWidget)) class UButton* MyButton_Pause;                  if(EnemyRange < 100) MyTextBlock_String->SetText(FText::FromName("Alert! : Enemy Near, You"));//UPROPERTY(BlueprintReadWrite, meta = (BindWidget)) class UTextBlock* MyTextBlock_String; } void UTestWidget::GamePause() { class UGameplayStatics::SetGamePaused(GetWorld(), true); } //AMyHUD.h with #include "GameFramework/HUD.h"  UPROPERTY(EditDefaultsOnly) TSubclassOf<class UUserWidget>  theTestWidget; void AMyHUD::PortWidget() {                                  UTestWidget* theTestWidge

Animation

 Unreal void UMy_AnimInstance::NativeInitializeAnimation() {   if (theActorPawn == nullptr) theActorPawn = TryGetPawnOwner();//UPROPERTY() APawn* theActorPawn; if (IsValid(theActorPawn)) thePawnMomnt_Framwork = theActorPawn->GetMovementComponent();  } void UMy_AnimInstance::NativeUpdateAnimation(float DeltaSecond) { if (thePawnMomnt_Framwork && theActorPawn) {//UPROPERTY() UPawnMovementComponent* thePawnMomnt_Framwork; plyrMovmntSpeed = theActorPawn->GetVelocity().Size();UPROPERTY(BlueprintReadOnly) float plyrMovmntSpeed;                                 plyrIsJump = thePawnMomnt_Framwork->IsFalling();////UPROPERTY(BlueprintReadOnly) bool plyrIsJump;                 //UPROPERTY() AMyPlayerChar* thePlyrClass; if ((thePlyrClass = Cast<AMyPlayerChar>(theActorPawn)) != nullptr)  plyrCrouch = thePlyrClass->isCrouch;//UPROPERTY(BlueprintReadOnly) bool plyrCrouch; } Unity     Animator anim;     void Start() => anim = GetComponentInChildren<Animator

Navigation Mesh

 Unreal void APlayerChar::Tick(float DeltaTime) { Super::Tick(DeltaTime);         AActor* thePlyr; UNavigationSystem::SimpleMoveToActor(GetController(), thePlyr); } Unity NavMeshAgent agnt; private void Update() => agnt.SetDestination(thePlyr.transform.position);

Play Sound

 Unreal void AGameActor::PlaySoundEffect() {                 USoundBase* theSoundFX; class UGameplayStatics::PlaySoundAtLocation(this, theSoundFX, GetActorLocation());//#include "Sound/SoundBase.h" } Unity void AGameActor::PlaySoundEffect() {        AudioSource* theSoundFX = GetComponent<AudioSource>();//audioSource.PlayOneShot(audioClip, 0.7f);        theSoundFX.Play(); }

Spawn Particles

 Unreal void AGameActor::PlayParticleEffect() {                 UParticleSystem* theParticleFX; class UGameplayStatics::SpawnEmitterAtLocation(this, theParticleFX, GetActorLocation());//#include "Particles/ParticleSystem.h" } Unity void PlayParticleEffect() {         ParticleSystem theParticleFX = GetComponent<ParticleSystem>();         theParticleFX.Play(); }

Tag

 Unreal void APlayerChar::NotifyActorBeginOverlap(AActor* OtherActor) { Super::NotifyActorBeginOverlap(OtherActor);                 if(GetCapsuleComponet->ComponentHasTag("OtherComp")) UE_LOG(LogTemp, Display, TEXT("OtherComp has Overlap the Player Capsule")); } Unity Override void OnTriggerEnter(Collider other) => if (other.gameObject.CompareTag("OtherObj")) Debug.Log("the Player Capsule has Trigger OtherObj");