Description

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.

Steps to Reproduce
  1. Open UE4 Editor (any project)
  2. Add code to project based on Actor (MyActor)
  3. Add the following to MyActor.h
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Test)
    	UStaticMeshComponent* TestMesh;
    
    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = Test)
    	UParticleSystemComponent* TestParticle;
    
  4. Add the following to MyActor.cpp
    	TestMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("TestMesh"));
    	
    
    	TestParticle = CreateDefaultSubobject<UParticleSystemComponent>(TEXT("TestParticle"));
    	RootComponent = TestMesh;
    	//TestParticle->AttachToComponent(TestMesh, FAttachmentTransformRules(EAttachmentRule::SnapToTarget, true));
    
  5. Compile
  6. Create default particle system (ParticleBP)
  7. Create blueprint based on MyActor (MyActorBP)
  8. In blueprint, set TestParticle to ParticleBP
  9. Add instance of MyActorBP to the level

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

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

8
Login to Vote

Won't Fix
ComponentUE - Gameplay
Affects Versions4.14.14.15
Target Fix4.16
CreatedDec 27, 2016
ResolvedJan 20, 2017
UpdatedApr 27, 2018
View Jira Issue