动态生成组件
以下为动态生成样条组件示例:
生成组件:
USplineComponent* SplineComponent = NewObject<USplineComponent>(this, USplineComponent::StaticClass());
AttachActor:
注:组件的吸附要用SetupAttachment,而且必须在注册组件之前使用
SplineComponent->SetupAttachment(RootComponent);
注册组件:
SplineComponent->RegisterComponent();
动态卸载组件
以下为动态删除组件示例:
取消注册组件:
SplineComponent->UnregisterComponent();
摧毁组件:
SplineComp->DestroyComponent();