# TryRead

> Reads bytes from a binary reader, validates the expected serialized version, and deserializes them into a new blob asset.

## Definition

* **Type:** Method
* **Namespace:** [Unity.Entities](/engine/7000.0/script-reference/unity/entities.md)
* **Assembly:** UnityEngine.EntitiesModule

## TryRead\<T>(T, int, BlobAssetReference\<T>)

Reads bytes from a binary reader, validates the expected serialized version, and deserializes them into a new blob asset.

```csharp
public static bool TryRead<U>(U binaryReader, int version, out BlobAssetReference<T> result) where U : BinaryReader
```

### Parameters

**** (T): The reader for the blob data path**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Expected version number of the blob data.**** (\[BlobAssetReference\<T>]\(/engine/7000.0/script-reference/unity/entities/blobassetreference1)): The resulting BlobAssetReference if the data was read successful.

### Returns

| Type                                                          | Description                                             |
| ------------------------------------------------------------- | ------------------------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | True if the data was successfully read, false otherwise |

## TryRead(string, int, BlobAssetReference\<T>)

Reads bytes from a fileName, validates the expected serialized version, and deserializes them into a new blob asset.

```csharp
public static bool TryRead(string path, int version, out BlobAssetReference<T> result)
```

### Parameters

**** (\[string]\(https\://learn.microsoft.com/dotnet/api/system.string)): The path of the blob data to read.**** (\[int]\(https\://learn.microsoft.com/dotnet/api/system.int32)): Expected version number of the blob data.**** (\[BlobAssetReference\<T>]\(/engine/7000.0/script-reference/unity/entities/blobassetreference1)): The resulting BlobAssetReference if the data was read successful.

### Returns

| Type                                                          | Description                               |
| ------------------------------------------------------------- | ----------------------------------------- |
| [bool](https://learn.microsoft.com/dotnet/api/system.boolean) | A bool if the read was successful or not. |
