Adding a UStaticMeshComponent pointer to a class derived from StaticMeshComponent allows for two meshes to be set by a single component. Setting two meshes inside a blueprint this way will only allow one of the meshes to be edited by selecting it (the second component can only be edited through the Details panel). If an instance of the blueprint is added to the level, the uncontrolled mesh will appear at world origin. Colliding with the "ghost" component will cause it to shoot off.
1. Open UE4Editor (code project)
2. Add code to project based on StaticMeshComponent(TestComponent)
3. In TestComponent.h add the following:
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = test) UStaticMeshComponent* MyMesh;
4. In TestComponent.cpp add the following to the constructor:
MyMesh = CreateDefaultSubobject<UStaticMeshComponent>(TEXT("MyMesh"));
5. Compile
6. Create Blueprint based on TestComponent (TestComponentBP), and an actor blueprint (TestBP)
7. Add component "Test" to the blueprint
8. In the Details panel add a static mesh to each of the StaticMesh slots
9. Place BP instance into the level
Result:
Cannot select second mesh in BP viewport to edit transform. Interacting with component in PIE has unexpected results.
There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-19747 in the post.
0 |
Component | UE - Gameplay - Components |
---|---|
Affects Versions | 4.8.3, 4.9 |
Created | Aug 6, 2015 |
---|---|
Resolved | Mar 12, 2020 |
Updated | Mar 12, 2020 |