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」を追加するようなコードがあると思います。
これを解決するために以下のように「AActor::SetRootComponent」関数を使って「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」を追加するようなコードがあると思います。
上記の実装だと「none of them were set as the actor's RootComponent」という「Warning」が出ます。// Actor
ABlogActor::ABlogActor()
{// Component を追加
this->MeshComponent = CreateDefaultSubobject< USkeletalMeshComponent>(TEXT("MeshComponent"));}
これを解決するために以下のように「AActor::SetRootComponent」関数を使って「RootComponent」を指定してあげます。
こうすることで「Warning」を消すことができます。// Actor
ABlogActor::ABlogActor()
{// Component を追加
this->MeshComponent = CreateDefaultSubobject< USkeletalMeshComponent>(TEXT("MeshComponent"));
this->SetRootComponent(this->MeshComponent);}
ここらへん「Warning」のメッセージを読むだけだとどうやって対処したらいいのかがわからないので
一つ一つ覚えていくしかなさそかなと思います。
| UE5 | 10:00 | comments:0 | trackbacks:0 | TOP↑