void AActor::ProcessUserConstructionScript() { // Set a flag that this actor is currently running UserConstructionScript. bRunningUserConstructionScript = true; UserConstructionScript(); bRunningUserConstructionScript = false; // Validate component mobility after UCS execution TInlineComponentArray<USceneComponent*> SceneComponents; GetComponents(SceneComponents); for (auto SceneComponent : SceneComponents) { // A parent component can't be more mobile than its children, so we check for that here and adjust as needed. if(SceneComponent != RootComponent && SceneComponent->AttachParent != nullptr && SceneComponent->AttachParent->Mobility > SceneComponent->Mobility) { if(SceneComponent->IsA<UStaticMeshComponent>()) { // SMCs can't be stationary, so always set them (and any children) to be movable SceneComponent->SetMobility(EComponentMobility::Movable); } else { // Set the new component (and any children) to be at least as mobile as its parent SceneComponent->SetMobility(SceneComponent->AttachParent->Mobility); } } } }
void AActor::ProcessUserConstructionScript() { // Set a flag that this actor is currently running UserConstructionScript. bRunningUserConstructionScript = true; UserConstructionScript(); bRunningUserConstructionScript = false; // Register all deferred components for this actor. FDeferRegisterStaticComponents::Get().RegisterComponents(this); }