本文整理汇总了C++中constructorhelpers::FObjectFinder::Succeeded方法的典型用法代码示例。如果您正苦于以下问题:C++ FObjectFinder::Succeeded方法的具体用法?C++ FObjectFinder::Succeeded怎么用?C++ FObjectFinder::Succeeded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类constructorhelpers::FObjectFinder
的用法示例。
在下文中一共展示了FObjectFinder::Succeeded方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: MeshFinder
AStick::AStick(){
RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootComponent"));
Stick = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("OurVisibleComponent"));
Stick->SetMobility(EComponentMobility::Movable);
Stick->CastShadow = false;
Stick->AttachTo(RootComponent);
UStaticMesh *mesh = nullptr;
static ConstructorHelpers::FObjectFinder<UStaticMesh> MeshFinder(TEXT("StaticMesh'/Game/Models/Baculo/baculo_model.baculo_model'"));
if (MeshFinder.Succeeded()){
mesh = MeshFinder.Object;
Stick->SetStaticMesh(mesh);
}
Stick->SetWorldScale3D(FVector(0.75, 0.75, 0.75));
StickMaterial = ((UPrimitiveComponent*)GetRootComponent())->CreateAndSetMaterialInstanceDynamic(0);
UMaterial* mat = nullptr;
static ConstructorHelpers::FObjectFinder<UMaterial> MatFinder(TEXT("Material'/Game/Models/Baculo/baculo_diffuse.baculo_diffuse'"));
if (MatFinder.Succeeded()){
mat = MatFinder.Object;
StickMaterial = UMaterialInstanceDynamic::Create(mat, GetWorld());
}
EffectsMaterial = ((UPrimitiveComponent*)GetRootComponent())->CreateAndSetMaterialInstanceDynamic(1);
mat = nullptr;
static ConstructorHelpers::FObjectFinder<UMaterial> MatFinderEffects(TEXT("Material'/Game/Models/Baculo/baculoBloom_material.baculoBloom_material'"));
if (MatFinderEffects.Succeeded()){
mat = MatFinderEffects.Object;
EffectsMaterial = UMaterialInstanceDynamic::Create(mat, GetWorld());
}
BBMaterial = CreateDefaultSubobject<UMaterialBillboardComponent>(TEXT("BB"));
BBMaterial->AttachTo(RootComponent);
BBMaterial->SetMobility(EComponentMobility::Movable);
BBMaterial->CastShadow = false;
BBMaterial->SetRelativeLocation(FVector(0, 0, 70));
}
示例2: BasicMat
// Sets default values
AHairSegment::AHairSegment()
{
PrimaryActorTick.bCanEverTick = false;
ProceduralMeshData = NewObject<UProceduralMeshData>();
ProceduralMesh = CreateDefaultSubobject<UProceduralMeshComponent>(TEXT("GeneratedMesh"));
RootComponent = ProceduralMesh;
ProceduralMesh->SetCollisionProfileName(TEXT("OverlapAll"));
OutlineMesh = CreateDefaultSubobject<UProceduralMeshComponent>(TEXT("OutlineMesh"));
static ConstructorHelpers::FObjectFinder<UMaterialInterface> BasicMat(TEXT("MaterialInterface'/Game/Materials/M_Basic.M_Basic'"));
if (BasicMat.Succeeded())
OutlineMesh->SetMaterial(0, BasicMat.Object);
OutlineMesh->SetRenderInMainPass(false);
OutlineMesh->SetCastShadow(false);
Spline = CreateDefaultSubobject<USplineComponent>(TEXT("Spline"));
Spline->SetupAttachment(RootComponent);
Spline->ClearSplinePoints();
static ConstructorHelpers::FObjectFinder<UMaterialInterface> TmpMat(TEXT("MaterialInterface'/Game/Materials/M_Test.M_Test'"));
if (TmpMat.Succeeded())
Material = TmpMat.Object;
if (Material)
SetSegmentMaterial(0, Material);
}
示例3: SphereVisualAsset
// Sets default values
AProjectile::AProjectile()
{
// 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;
CollisionComp = CreateDefaultSubobject<USphereComponent>(TEXT("Collision_Component"));
CollisionComp->SetSphereRadius(5.0f);
CollisionComp->AttachTo(RootComponent);
CollisionComp->SetCollisionEnabled(ECollisionEnabled::QueryAndPhysics);
CollisionComp->SetCollisionObjectType(ECollisionChannel::ECC_WorldDynamic);
SphereVisual = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Sphere_Mesh"));
SphereVisual->AttachTo(CollisionComp);
static ConstructorHelpers::FObjectFinder<UStaticMesh> SphereVisualAsset(TEXT("/Game/StarterContent/Shapes/Shape_Sphere.Shape_Sphere"));
if (SphereVisualAsset.Succeeded())
{
SphereVisual->SetStaticMesh(SphereVisualAsset.Object);
SphereVisual->SetRelativeLocation(FVector(-7.0f, 0.0f, 0.0f));
SphereVisual->SetWorldScale3D(FVector(0.2f, 0.04f, 0.02f));
SphereVisual->SetCollisionEnabled(ECollisionEnabled::NoCollision);
static ConstructorHelpers::FObjectFinder<UMaterial> MaterialAsset(TEXT("/Game/Materials/BulletMat"));
if (MaterialAsset.Succeeded())
{
SphereVisual->SetMaterial(0, MaterialAsset.Object);
}
UProjectileMovementComponent* ProjectileMovement = CreateDefaultSubobject<UProjectileMovementComponent>(TEXT("Projectile_Movement"));
ProjectileMovement->InitialSpeed = 2000.0f;
ProjectileMovement->ProjectileGravityScale = 0.0f;
}
}
示例4: ofMesh
// Sets default values
AExplodeRay::AExplodeRay()
{
// 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;
// Find assets
static ConstructorHelpers::FObjectFinder<UStaticMesh> ofMesh(TEXT("StaticMesh'/Game/StaticMeshes/Shape_Cube.Shape_Cube'"));
static ConstructorHelpers::FObjectFinder<UMaterial> ofMat(TEXT("Material'/Game/Materials/M_Ray.M_Ray'"));
m_pMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("Mesh"));
m_pMesh->SetCollisionProfileName(TEXT("NoCollision"));
if (ofMesh.Succeeded() &&
ofMat.Succeeded())
{
m_pMesh->SetStaticMesh(ofMesh.Object);
m_pMesh->SetRelativeLocation(FVector(0.0f, 0.0f, -50.0f));
m_pParentMat = ofMat.Object;
}
m_pBox = CreateDefaultSubobject<UBoxComponent>(TEXT("Box"));
m_pBox->InitBoxExtent(FVector(50.0f, 50.0f, 50.0f));
m_pBox->SetCollisionProfileName(TEXT("OverlapAll"));
m_pBox->SetCollisionResponseToChannel(ECollisionChannel::ECC_GameTraceChannel1, ECollisionResponse::ECR_Ignore);
RootComponent = m_pBox;
m_pMesh->AttachTo(RootComponent);
m_fTime = EXPLODE_RAY_LIFETIME;
}
示例5: GunAsset
// Sets default values
ARifle::ARifle()
{
// Max ammo in one clip
ClipSize = 30;
// Ammo per clip/magazine
AmmoCount = ClipSize;
// Rounds per second
SetRPS(10.0f);
// Range of rifle
SetRange(2000.0f);
// Damage values
SetPlayerDamage(0.5f);
SetEnemyDamage(20.0f);
static ConstructorHelpers::FObjectFinder<USkeletalMesh> GunAsset(TEXT("/Game/FPWeapon/Mesh/SK_FPGun.SK_FPGun"));
if (GunAsset.Succeeded())
{
static ConstructorHelpers::FObjectFinder<UMaterial> MaterialAsset(TEXT("/Game/FPWeapon/Materials/M_FPGun"));
if (MaterialAsset.Succeeded())
{
SetupWeaponMesh(GunAsset.Object, MaterialAsset.Object, FVector(0.0f, 0.0f, 0.0f), FRotator(0.0f, -90.0f, 0.0f));
}
SetupArrowComp(FVector(0.0f, 50.0f, 11.0f), FRotator(0.0f, 90.0f, 0.0f));
}
}
示例6: SphereVisualAsset
// Sets default values
ACollidingPawn::ACollidingPawn()
{
// Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
// Tutorial code
// Our root component will be a sphere that reats to Physics
USphereComponent* SphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("RootComponent"));
RootComponent = SphereComponent;
SphereComponent->InitSphereRadius(40.0f);
SphereComponent->SetCollisionProfileName(TEXT("Pawn"));
// Creating and correctly Positioning the Mesh component so that it fits the sphere collision
UStaticMeshComponent* SphereVisual = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("VisualRepresentation"));
SphereVisual->AttachTo(RootComponent);
static ConstructorHelpers::FObjectFinder<UStaticMesh> SphereVisualAsset(TEXT("/Game/StarterContent/Shapes/Shape_Sphere.Shape_Sphere"));
if (SphereVisualAsset.Succeeded())
{
SphereVisual->SetStaticMesh(SphereVisualAsset.Object);
SphereVisual->SetRelativeLocation(FVector(0.0f, 0.0f,-40.0f));
SphereVisual->SetWorldScale3D(FVector(0.8f));
}
// Particle system Creation, Positioning (Offset)
OurParticleSystem = CreateDefaultSubobject<UParticleSystemComponent>(TEXT("MovementParticles"));
OurParticleSystem->AttachTo(SphereVisual);
OurParticleSystem->bAutoActivate = false;
OurParticleSystem->SetRelativeLocation(FVector(-20.0f,0.0f,0.0f));
static ConstructorHelpers::FObjectFinder<UParticleSystem> ParticleAsset(TEXT("/Game/StarterContent/Particles/P_Fire.P_Fire"));
if (ParticleAsset.Succeeded())
{
OurParticleSystem->SetTemplate(ParticleAsset.Object);
}
// SpringArm creation for a smooth and fast Camera Experience ( We could have just avoided this springArm ) but for the sake of smoothness
USpringArmComponent* SpringArm = CreateAbstractDefaultSubobject<USpringArmComponent>(TEXT("CameraAttachmentArm"));
SpringArm->AttachTo(RootComponent);
SpringArm->RelativeRotation = FRotator(-45.0f,0.0f,0.0f);
SpringArm->TargetArmLength = 400.0f;
SpringArm->bEnableCameraLag = true;
SpringArm->CameraLagSpeed = 3.0f;
// Easy to create the Camera component and attach it to the built in Socket at the end of springArm
UCameraComponent* ActualCamera = CreateDefaultSubobject<UCameraComponent>(TEXT("ActualCamera"));
ActualCamera->AttachTo(SpringArm, USpringArmComponent::SocketName);
// Take control of the default player
AutoPossessPlayer = EAutoReceiveInput::Player0;
// creating an instance of our movement component, and telling it to update the root.
OurMovementComponent = CreateDefaultSubobject<UCollidingPawnMovementComponent>(TEXT("CustomMovementComponent"));
OurMovementComponent->UpdatedComponent = RootComponent;
}
示例7:
// Sets default values
ASkateboardPawn::ASkateboardPawn()
{
// Set this pawn to call Tick() every frame. You can turn this off to improve performance if you don't need it.
PrimaryActorTick.bCanEverTick = true;
// Makes the first player take control of this pawn automatically
AutoPossessPlayer = EAutoReceiveInput::Player0;
// Create a dummy root component we can attach things to
RootComponent = CreateDefaultSubobject<USceneComponent>(TEXT("RootComponent"));
// Create a camera and a visible object
UCameraComponent* Camera = CreateDefaultSubobject<UCameraComponent>(TEXT("CameraComponent"));
Mesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("MeshComponent"));
static ConstructorHelpers::FObjectFinder<UStaticMesh>CubeVisualAsset(TEXT("/Game/skateboard"));
if (CubeVisualAsset.Succeeded())
{
Mesh->SetStaticMesh(CubeVisualAsset.Object);
Mesh->SetSimulatePhysics(true);
//Mesh->SetMassOverrideInKg("", 100);
}
// Attach our camera and visible object to our root component. Offset and rotate the camera.
Camera->AttachTo(Mesh);
Camera->SetRelativeLocation(FVector(-450.0f, 0.0f, 450.0f));
Camera->SetRelativeRotation(FRotator(-45.0f, 0.0f, 0.0f));
Camera->SetWorldScale3D(FVector(1, 1, 1));
Mesh->AttachTo(RootComponent);
}
示例8: FVector
// Sets default values
AMotherActor::AMotherActor()
{
// 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;
UBoxComponent* Box = CreateDefaultSubobject<UBoxComponent>(TEXT("RootComponent"));
RootComponent = Box;
Box->InitBoxExtent(FVector(20.0f, 20.0f, 20.0f));
UBoxComponent* Box1 = CreateDefaultSubobject<UBoxComponent>(TEXT("Box"));
Box1->InitBoxExtent(FVector(60.0f, 60.0f, 60.0f));
Box1->RelativeLocation = FVector(100.0f, 0.0f, 0.0f);
USphereComponent* SphereComponent = CreateDefaultSubobject<USphereComponent>(TEXT("Sphere"));
SphereComponent->InitSphereRadius(60.0f);
SphereComponent->RelativeLocation = FVector(100.0f, 0.0f, 0.0f);
UStaticMeshComponent* SphereVisual = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("VisualRepresentation"));
static ConstructorHelpers::FObjectFinder<UStaticMesh> SphereVisualAsset(TEXT("/Game/StarterContent/Shapes/Shape_Sphere.Shape_Sphere"));
if (SphereVisualAsset.Succeeded()) {
SphereVisual->SetStaticMesh(SphereVisualAsset.Object);
SphereVisual->SetRelativeLocation(FVector(0.0f, 0.0f, -100.0f));
SphereVisual->SetWorldScale3D(FVector(0.8f));
}
Box1->AttachTo(RootComponent);
SphereVisual->AttachTo(RootComponent);
SphereComponent->AttachTo(RootComponent);
UChildActorComponent * ChildActor = CreateDefaultSubobject<UChildActorComponent>(TEXT("InventoryCamera"));
ChildActor->SetChildActorClass(AOrbitalActor::StaticClass());
ChildActor->CreateChildActor();
FVector position = GetActorLocation();
ChildActor->SetRelativeTransform(FTransform(position));
}
示例9: TEXT
// Sets default values
AHeatmapDataCollector::AHeatmapDataCollector(const FObjectInitializer& ObjectInitializer)
:Super(ObjectInitializer)
{
PrimaryActorTick.bCanEverTick = true;
FString StringOfCoords = "";
it = 0;
Billboard = ObjectInitializer.CreateDefaultSubobject<UBillboardComponent>(this, TEXT("Billboard"));
RootComponent = Billboard;
static ConstructorHelpers::FObjectFinder<UTexture2D> Spalsh(TEXT("Texture2D'/Engine/EditorResources/S_NavP.S_NavP'"));
if (Spalsh.Succeeded())
{
Billboard->SetSprite(Spalsh.Object);
}
TextComponent = ObjectInitializer.CreateDefaultSubobject<UTextRenderComponent>(this, TEXT("TextComponent"));
TextComponent->AttachTo(RootComponent);
TextComponent->WorldSize = 92;
TextComponent->bHiddenInGame = false;
PathSpline = ObjectInitializer.CreateDefaultSubobject<USplineComponent>(this, TEXT("PathSplineComponent"));
BeamParticle = ObjectInitializer.CreateDefaultSubobject<UParticleSystem>(this, TEXT("beamParticle"));
//BeamParticle->bAutoDeactivate = false;
}
示例10: SphereVisualAsset
AParticle::AParticle()
:
m_bobHeight( 50.f ),
m_sphereRadius(0.009f),
m_lightIntensity(50.f)
{
// Must turn on for floating animation
PrimaryActorTick.bCanEverTick = false;
// Set visual sphere as the root component
SphereVisual = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("RootComponent"));
RootComponent = SphereVisual;
// NOTE - Shape_Sphere.uasset must be located in the following directory at compile time (will be automatically created for projects with starter content)
static ConstructorHelpers::FObjectFinder<UStaticMesh> SphereVisualAsset(TEXT("/Game/StarterContent/Shapes/Shape_Sphere.Shape_Sphere"));
// Otherwise, the Shape_Sphere.uasset file must be physically located in the project's "Content" folder at compile time for it to show up
//static ConstructorHelpers::FObjectFinder<UStaticMesh> SphereVisualAsset(TEXT("/Game/Shape_Sphere.Shape_Sphere"));
if (SphereVisualAsset.Succeeded())
{
SphereVisual->SetStaticMesh(SphereVisualAsset.Object);
SphereVisual->SetWorldScale3D(FVector(m_sphereRadius));
}
// Create and attach point light
PointLight1 = CreateDefaultSubobject<UPointLightComponent>(TEXT("PointLight1"));
PointLight1->Intensity = m_lightIntensity;
PointLight1->bVisible = true;
PointLight1->SetupAttachment(SphereVisual);
}
示例11:
VehiclePawnWrapper::VehiclePawnWrapper()
{
static ConstructorHelpers::FObjectFinder<UParticleSystem> collision_display(TEXT("ParticleSystem'/AirSim/StarterContent/Particles/P_Explosion.P_Explosion'"));
if (!collision_display.Succeeded())
collision_display_template = collision_display.Object;
else
collision_display_template = nullptr;
}
示例12: Super
UChannelledAbility::UChannelledAbility() : Super() {
partclSystem = CreateDefaultSubobject<UParticleSystemComponent>(TEXT("ChannelLineParticleSystem"));
static ConstructorHelpers::FObjectFinder<UParticleSystem> ParticleSystemClass(TEXT("/Game/TopDown/Particle_Effects/AoE"));
if (ParticleSystemClass.Succeeded()) {
partclSystem->Template = ParticleSystemClass.Object;
partclSystem->bAutoActivate = false;
}
}
示例13: Super
UParametricSurfaceComponent::UParametricSurfaceComponent(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
, MaterialInterface(nullptr)
{
static ConstructorHelpers::FObjectFinder<UMaterialInterface> MI(TEXT("MaterialInstanceConstant'/Game/Materials/M_Simple_Inst.M_Simple_Inst'"));
if (MI.Succeeded())
{
MaterialInterface = MI.Object;
}
}
示例14: Super
APickupRocketLauncher::APickupRocketLauncher(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
if (nullptr != StaticMeshComp)
{
static ConstructorHelpers::FObjectFinder<UStaticMesh> SM(TEXT("StaticMesh'/Game/PrototypeWeap/Prototype_RocketLauncher_Pickup.Prototype_RocketLauncher_Pickup'"));
if (SM.Succeeded())
{
StaticMeshComp->SetStaticMesh(SM.Object);
}
}
static ConstructorHelpers::FObjectFinder<USoundCue> SC(TEXT("SoundCue'/Game/PrototypeWeap/Sound/RocketLauncher/RL_AmmoPickup_Cue.RL_AmmoPickup_Cue'"));
if (SC.Succeeded())
{
PickupSoundCue = SC.Object;
}
WeaponType = AWeaponRocketLauncher::StaticClass();
}
示例15: Super
APickupSniperRifle::APickupSniperRifle(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
if (nullptr != StaticMeshComp)
{
static ConstructorHelpers::FObjectFinder<UStaticMesh> SM(TEXT("StaticMesh'/Game/PrototypeWeap/Prototype_SniperRifle_Pickup.Prototype_SniperRifle_Pickup'"));
if (SM.Succeeded())
{
StaticMeshComp->SetStaticMesh(SM.Object);
}
}
static ConstructorHelpers::FObjectFinder<USoundCue> SC(TEXT("SoundCue'/Game/PrototypeWeap/Sound/SniperRifle/SR_AmmoPickup01_Cue.SR_AmmoPickup01_Cue'")); //!< 02, 03 ‚à‚ ‚é
if (SC.Succeeded())
{
PickupSoundCue = SC.Object;
}
WeaponType = AWeaponSniperRifle::StaticClass();
}