#### [Board](https://docs.dev.board.fun/unity/api/index.html "index")

### [Board.Save](https://docs.dev.board.fun/unity/api/Board.Save.html "Board\.Save"). [BoardSaveGameManager](https://docs.dev.board.fun/unity/api/BoardSaveGameManager.html "Board\.Save\.BoardSaveGameManager")

## BoardSaveGameManager.CreateSaveGame(byte\[\], BoardSaveGameMetadataChange) Method

Creates a saved game with the specified payload and metadata, returning the [metadata](https://docs.dev.board.fun/unity/api/BoardSaveGameMetadata.html "Board\.Save\.BoardSaveGameMetadata") for the saved game.

```
public static System.Threading.Tasks.Task<Board.Save.BoardSaveGameMetadata> CreateSaveGame(byte[] payload, Board.Save.BoardSaveGameMetadataChange metadataChange);
```

#### Parameters

`payload` [System.Byte](https://learn.microsoft.com/en-us/dotnet/api/system.byte "System\.Byte") [\[\]](https://learn.microsoft.com/en-us/dotnet/api/system.array "System\.Array")  
The save game payload (serialized game state).

`metadataChange` [BoardSaveGameMetadataChange](https://docs.dev.board.fun/unity/api/BoardSaveGameMetadataChange.html "Board\.Save\.BoardSaveGameMetadataChange")  
The [metadata](https://docs.dev.board.fun/unity/api/BoardSaveGameMetadataChange.html "Board\.Save\.BoardSaveGameMetadataChange") for the save game.

#### Returns

[System.Threading.Tasks.Task<](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 "System\.Threading\.Tasks\.Task\`1") [BoardSaveGameMetadata](https://docs.dev.board.fun/unity/api/BoardSaveGameMetadata.html "Board\.Save\.BoardSaveGameMetadata") [>](https://learn.microsoft.com/en-us/dotnet/api/system.threading.tasks.task-1 "System\.Threading\.Tasks\.Task\`1")  
The task object representing the asynchronous operation.

#### Exceptions

[System.ArgumentNullException](https://learn.microsoft.com/en-us/dotnet/api/system.argumentnullexception "System\.ArgumentNullException")  
[payload](https://docs.dev.board.fun/unity/api/BoardSaveGameManager.CreateSaveGame(byte[],BoardSaveGameMetadataChange).md#Board.Save.BoardSaveGameManager.CreateSaveGame(byte[],Board.Save.BoardSaveGameMetadataChange).payload "Board\.Save\.BoardSaveGameManager\.CreateSaveGame\(byte\[\], Board\.Save\.BoardSaveGameMetadataChange\)\.payload") or [metadataChange](https://docs.dev.board.fun/unity/api/BoardSaveGameManager.CreateSaveGame(byte[],BoardSaveGameMetadataChange).md#Board.Save.BoardSaveGameManager.CreateSaveGame(byte[],Board.Save.BoardSaveGameMetadataChange).metadataChange "Board\.Save\.BoardSaveGameManager\.CreateSaveGame\(byte\[\], Board\.Save\.BoardSaveGameMetadataChange\)\.metadataChange") is `null`.

### Remarks

The save game is automatically associated with [players](https://docs.dev.board.fun/unity/api/BoardSession.players.html "Board\.Session\.BoardSession\.players").
