| Parameter | Description |
|---|---|
| path | Path to the file. Accepts logical and physical paths. |
byte[] The entire file content as a byte array.
Reads all bytes from a file, resolving logical paths automatically.
Reads and returns all bytes in the file at path. Unlike File.ReadAllBytes, this method accepts logical paths directly without first converting them with FileUtil.PathToAbsolutePath.
Throws System.ArgumentException when path is null or empty.
Additional resources: FileUtil.OpenRead, FileUtil.ReadAllText, FileUtil.ReadAllLines
using UnityEditor; using UnityEngine;
public class ReadAllBytesExample { [MenuItem("Example/Read File Bytes")] static void ReadFileBytes() { byte[] data = FileUtil.ReadAllBytes("Packages/com.example.package/Resources/data.bytes"); Debug.Log("Read " + data.Length + " bytes."); } }