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?

UnrealEngineのAutomationSpecでSpawnActor

Posted at

UnrealEngineのAutomationSpecでSpawnActorする方法をメモしておきます。

環境

UE5.5.4

参照コード

CesiumForUnrealプラグインのコードを参照しました。

試したコード

build.csのPrivateDependencyModuleNamesあたりにUnrealEdを追加して、以下のようなテストを書くことでSpawnActorできました。

#include "Tests/AutomationEditorCommon.h"
#include "Misc/AutomationTest.h"


BEGIN_DEFINE_SPEC(SampleTest, "SampleTest.SampleActor", EAutomationTestFlags::ProductFilter | EAutomationTestFlags_ApplicationContextMask)
END_DEFINE_SPEC(SampleTest)

void SampleTest::Define()
{
	Describe("SampleActor", [this]()
		{
			It("Spawn", [this]()
				{
                	UWorld* World = FAutomationEditorCommonUtils::CreateNewMap();
                    ASampleActor* Tileset = World->SpawnActor<ASampleActor>(FVector::ZeroVector, FRotator::ZeroRotator);
				});
		});
}
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?