文档

Unity Engine

Download Unity

Unity Engine

TryRead

Reads bytes from a binary reader, validates the expected serialized version, and deserializes them into a new blob asset.
阅读时间1 分钟最后更新于 19 天前

Definition

  • Type: Method
  • Namespace: Unity.Entities
  • 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.
public static bool TryRead<U>(U binaryReader, int version, out BlobAssetReference<T> result) where U : BinaryReader

Parameters

binaryReader

T
The reader for the blob data path

version

Expected version number of the blob data.

The resulting BlobAssetReference if the data was read successful.

Returns

Type

Description

boolTrue 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.
public static bool TryRead(string path, int version, out BlobAssetReference<T> result)

Parameters

path

The path of the blob data to read.

version

Expected version number of the blob data.

The resulting BlobAssetReference if the data was read successful.

Returns

Type

Description

boolA bool if the read was successful or not.