UnrealScripterAI
Discord ↗
Link Copied to Clipboard
×
"create a cube"
// Create a Cube in Unreal ACubeActor::ACubeActor() { // 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; // Create a Cube Component CubeComponent = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Cube Component")); RootComponent = CubeComponent; // Load the Cube Mesh static ConstructorHelpers::FObjectFinder<UStaticMesh> CubeMesh(TEXT("StaticMesh'/Engine/BasicShapes/Cube.Cube'")); if (CubeMesh.Succeeded()) { CubeComponent->SetStaticMesh(CubeMesh.Object); } }