When a particle system component is created in code, the particle system component will appear at world origin rather than parent actor origin if AttachToComponent / SetupAttachment / etc. is not expressly used from code.
This is inconsistent with other components that will default their position to the actor's position upon creation.
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Test) UStaticMeshComponent* TestMesh; UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Test) UParticleSystemComponent* TestParticle;
TestMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("TestMesh")); TestParticle = CreateDefaultSubobject<UParticleSystemComponent>(TEXT("TestParticle")); RootComponent = TestMesh; //TestParticle->AttachToComponent(TestMesh, FAttachmentTransformRules(EAttachmentRule::SnapToTarget, true));
Result:
Particle system will be displayed at the world origin regardless where the actor is placed
Expected:
Particle System Component is created in the parent actor's root location by default
Head over to the existing Questions & Answers thread and let us know what's up.
8 |
Component | UE - Gameplay |
---|---|
Affects Versions | 4.14.1, 4.15 |
Target Fix | 4.16 |
Created | Dec 27, 2016 |
---|---|
Resolved | Jan 20, 2017 |
Updated | Apr 27, 2018 |