fc2ブログ

凛(kagring)のUE5/UE4とゲーム制作と雑記ブログ

2016 年から UE4 / 2021年から UE5 を触り始めました。勉強したもののメモ用ブログです。ゲーム制作に関するメモや雑記とか色々あります。C++ での Qt、Unity もほんの少しあります。

PREV | PAGE-SELECT | NEXT

≫ EDIT

UE5 「none of them were set as the actor's RootComponent」という「Warning」が出てしまう場合の対処方法(AActor::SetRootComponent)

「none of them were set as the actor's RootComponent」という「Warning」が出てしまう場合の対処方法です。

こちらの投稿を参考にさせていただきました。

・Warning: None of them were set as the actor’s RootComponent
https://forums.unrealengine.com/t/warning-none-of-them-were-set-as-the-actors-rootcomponent/366781

どうも「RootComponent」がないよ。という「Warning」みたいですね。
なので「RootComponent」の設定をしてあげることで解決するようです。

まずはこんな感じでコンストラクタで「Component」を追加するようなコードがあると思います。

// Actor
ABlogActor::ABlogActor()
{

// Component を追加
this->MeshComponent = CreateDefaultSubobject< USkeletalMeshComponent>(TEXT("MeshComponent"));
}

上記の実装だと「none of them were set as the actor's RootComponent」という「Warning」が出ます。

これを解決するために以下のように「AActor::SetRootComponent」関数を使って「RootComponent」を指定してあげます。

// Actor
ABlogActor::ABlogActor()
{

// Component を追加
this->MeshComponent = CreateDefaultSubobject< USkeletalMeshComponent>(TEXT("MeshComponent"));
this->SetRootComponent(this->MeshComponent);
}

こうすることで「Warning」を消すことができます。

ここらへん「Warning」のメッセージを読むだけだとどうやって対処したらいいのかがわからないので
一つ一つ覚えていくしかなさそかなと思います。

| UE5 | 10:00 | comments:0 | trackbacks:0 | TOP↑

COMMENT















非公開コメント

TRACKBACK URL

http://kagring.blog.fc2.com/tb.php/878-0fbdfdce

TRACKBACK

PREV | PAGE-SELECT | NEXT