TryGetFilePath(GUID, string, out string)
Attempts to get the path to a specific file within a build's metadata folder.
Read time 1 minuteLast updated 10 days ago
Definition
- Type: Method
- Namespace: UnityEditor.Build
- Assembly: UnityEditor.CoreModule
TryGetFilePath(GUID, string, string)
public static bool TryGetFilePath(GUID buildSessionGuid, string filename, out string filePath)
Parameters
Returns
Type | Description |
|---|---|
| bool | |
Examples
using UnityEditor;using UnityEditor.Build;using UnityEditor.Build.Reporting;using UnityEngine;public class GetTepFileExample{ [MenuItem("Example/BuildHistory/Get Build Performance Profiling File Path")] static public void GetTraceEventFilePath() { // Example showing how to get the path to the trace event file // recording build performance profiling information about the latest build. if (!BuildHistory.TryGetLatestBuild(out GUID latestBuildGuid)) { Debug.Log("No builds found in build history."); return; } // Check if the latest build wrote a profiler file string tepFilename = "BuildContentTEP.json"; if (BuildHistory.TryGetFilePath(latestBuildGuid, tepFilename, out string tepFilePath)) { Debug.Log($"Found Trace Event file for latest build: {tepFilePath}."); } else { // The file might not exist if the latest build wasn't a ContentDirectory build. Debug.Log($"Trace Event file '{tepFilename}' not found for the latest build."); } }}