ReadAllLines(string)
Reads all lines from a file, resolving logical paths automatically.
Read time 1 minuteLast updated 11 days ago
Definition
- Type: Method
- Namespace: UnityEditor
- Assembly: UnityEditor.CoreModule
public static string[] ReadAllLines(string path)
Parameters
Path to the file. Accepts logical and physical paths.
Returns
Type | Description |
|---|---|
| string[] | An array containing one element per line. Lines are split on |
Remarks
Reads the entire file at and returns its lines as a string array. Unlike , this method accepts logical paths directly without first converting them with FileUtil.PathToAbsolutePath.
pathFile.ReadAllLinesThrows ArgumentException when is null or empty.
pathExamples
using UnityEditor;using UnityEngine;public class ReadAllLinesExample{ [MenuItem("Example/Read File Lines")] static void ReadFileLines() { string[] lines = FileUtil.ReadAllLines("Packages/com.example.package/Resources/manifest.txt"); foreach (string line in lines) Debug.Log(line); }}