Hello! I have a UObject derrived class in code, that has three components on it: SceneComponent(root), MeshComponent and CapsuleComponent(in order of inheritance). Before I had just mesh and capsule components and blueprints, which are childrens of that class, was in scenes. So, when i added root scenecomponent, my objects meshes had moved to zero of scene, but UObject’s transforms wasn’t changed, and now it doesn’t apply to mesh position.
Here is my class:
// EoStation.h
UCLASS()
class EODEMO_API AEoStation : public AActor
{
GENERATED_UCLASS_BODY()
UPROPERTY(EditDefaultsOnly, BlueprintReadOnly, Category = "Gameplay")
FName ObjectType;
UPROPERTY(Category = "Scene", VisibleAnywhere, BlueprintReadOnly)
class USceneComponent* Root;
UPROPERTY(Category = "Rendering", VisibleAnywhere, BlueprintReadOnly)
class UStaticMeshComponent* Mesh;
UPROPERTY(Category = "Collision", VisibleAnywhere, BlueprintReadOnly)
class UCapsuleComponent* DockTrigger;
};
// EoStation.cpp
AEoStation::AEoStation(const FObjectInitializer& ObjectInitializer)
: Super(ObjectInitializer)
{
Root = ObjectInitializer.CreateDefaultSubobject<USceneComponent>(this, TEXT("Root"));
RootComponent = Root;
Mesh = ObjectInitializer.CreateDefaultSubobject<UStaticMeshComponent>(this, TEXT("Mesh"));
Mesh->AttachParent = Root;
DockTrigger = ObjectInitializer.CreateDefaultSubobject<UCapsuleComponent>(this, TEXT("DockTrigger"));
DockTrigger->AttachParent = Mesh;
}
If I replace object on scene, then all is correct. Do I need to replace all changed blueprints, or there is any way to fix it without recreating all scenes?