Attempting to add multiple instances of a Scene Component that was created in code and contains a component such as a Box Collider causes the Box Colliders of each Scene Component to be parented to the most recently added one, instead of the one that it should be attached to.
Found in 4.10.1. Reproduced in 4.11 Preview 1 and Main CL 2811183
1. Open the editor
2. Create a new C++ class based on Scene Component
3. Add this code to the .h
UPROPERTY(EditAnywhere, BlueprintReadWrite) UBoxComponent* Box;
4. Add this code to the .cpp
Box = CreateDefaultSubobject<UBoxComponent>(TEXT("BoxCollider")); Box->AttachTo(this);
5. Compile
6. Back in the Editor, create a new Actor Blueprint
7. Add two instances of the C++ class you created as components
8. Drag your Actor into the level (Notice that the box colliders are correctly parented when you first drag it in if you look in the component tree in the Details Panel of the viewport)
9. Click off of the Actor, and then reselect it.
Result: The Box components are now parented to the last Scene Component, instead of being parented to the correct owners.
Expected: The box components would attach to each individual scene component, not the most recent one.
Head over to the existing Questions & Answers thread and let us know what's up.
0 |
Component | UE - Gameplay - Components |
---|---|
Affects Versions | 4.10, 4.11, 4.12 |
Target Fix | 4.13 |
Fix Commit | 3004871 |
---|---|
Main Commit | 3025946 |
Created | Jan 5, 2016 |
---|---|
Resolved | Jun 7, 2016 |
Updated | Apr 27, 2018 |