Version: 2022.1
LanguageEnglish
  • C#

AsyncReadManager.CloseCachedFileAsync

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Declaration

public static Unity.Jobs.JobHandle CloseCachedFileAsync(string fileName, Unity.Jobs.JobHandle dependency);

Parameters

fileName The path to the file to close.
dependency (Optional) A JobHandle to wait on before performing the close.

Returns

JobHandle A JobHandle that completes when the asynchronous close operation finishes.

Description

Closes a file held open internally by the AsyncReadManager.

The AsyncReadManager has an internal cache of up to 10 open files, so use this method if you experience a sharing violation when trying to access one of these files that is held open.

Note: Do not use this method for files opened with OpenFileAsync, as these files do not go into the AsyncReadManager's file cache. Use FileHandle.Close instead.