# UAutoMeshEngineSpawnComponent

`UAutoMeshEngineSpawnComponent` belongs to the AutoMesh Engine runtime module.

Occaecat ad sed pariatur esse dolor commodo esse esse laboris occaecat. Sit et excepteur occaecat adipiscing excepteur et ex adipiscing velit nisi aliqua nostrud aute. Do commodo aliquip in in ea enim commodo amet aliqua esse adipiscing reprehenderit. Incididunt aliqua tempor sit sint do consequat velit.

## Declaration

```cpp
UCLASS(ClassGroup=(Custom), meta=(BlueprintSpawnableComponent))
class AUTO_MESH_ENGINE_API UMyComponent : public UActorComponent
{
    GENERATED_BODY()

public:
    UMyComponent();

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Settings")
    float UpdateInterval = 0.1f;

    UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Settings")
    bool bAutoActivate = true;

    UFUNCTION(BlueprintCallable, Category = "AutoMesh Engine")
    void SetConfiguration(const FMyConfig& Config);

protected:
    virtual void BeginPlay() override;
    virtual void TickComponent(float DeltaTime, ELevelTick TickType, FActorComponentTickFunction* ThisTickFunction) override;

private:
    FMyConfig CurrentConfig;
    float TimeSinceLastUpdate = 0.0f;
};
```

## Members

| Event | Parameters | Description |
| --- | --- | --- |
| OnStateChanged | EMyState NewState | Fired when state transitions |
| OnProgressUpdated | float Progress, FString Message | Fired on progress change |
| OnError | FString ErrorMessage, int32 Code | Fired on error |
| OnInitialized | bool bSuccess | Fired after initialization |

## Example

```cpp
// Declare delegates for event-driven communication
DECLARE_DYNAMIC_MULTICAST_DELEGATE_OneParam(FOnStateChanged, EMyState, NewState);
DECLARE_DYNAMIC_MULTICAST_DELEGATE_TwoParams(FOnProgressUpdated, float, Progress, FString, Message);

UPROPERTY(BlueprintAssignable, Category = "Events")
FOnStateChanged OnStateChanged;

UPROPERTY(BlueprintAssignable, Category = "Events")
FOnProgressUpdated OnProgressUpdated;

// Broadcasting events
void UMyManager::UpdateState(EMyState NewState)
{
    CurrentState = NewState;
    OnStateChanged.Broadcast(NewState);
    OnProgressUpdated.Broadcast(GetProgress(), GetStatusMessage());
}
```

> **Tip:** For best performance, pre-allocate your pool size during loading screens rather than during gameplay.