0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

[UE4,5]UnrealC++からActorComponent SceneComponentを追加する

Last updated at Posted at 2022-12-12

端的にUnrealC++から以下のコンポーネントを追加します。

  • ActorComponent
  • SceneComponent
#include "MyActor.h"
#include "Components/StaticMeshComponent.h"
#include "GameFramework/FloatingPawnMovement.h"

// Sets default values
AMyActor::AMyActor()
{
 	// Set this actor to call Tick() every frame.  You can turn this off to improve performance if you don't need it.
	PrimaryActorTick.bCanEverTick = true;

	// Sceneコンポネントをアタッチ
	Mesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
	RootComponent = Cast<USceneComponent>(Mesh);

	// Actorコンポネントをアタッチ
	FloatingMovement = CreateDefaultSubobject<UFloatingPawnMovement>(TEXT("FloatingMovement"));
	AddOwnedComponent(FloatingMovement);
}

これが
1_1.PNG

こう
1_2.PNG

是非試してみてください~

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?