123456789101112131415161718192021222324252627 |
- // Copyright (c) 2025 TerraByte Inc.
- //
- // A new utility class that uses [InitializeOnLoad] to safely cache data
- // from Unity's main thread that is needed by background threads.
- using System.IO;
- using UnityEngine;
- using UnityEditor;
- using UnityEngine.Scripting;
- namespace Terra.Arbitrator.Services
- {
- [Preserve]
- [InitializeOnLoad]
- public static class MainThreadDataCache
- {
- /// <summary>
- /// A thread-safe, cached path to the project's root directory.
- /// </summary>
- public static string ProjectRoot { get; private set; }
- static MainThreadDataCache()
- {
- ProjectRoot = Directory.GetParent(Application.dataPath)?.FullName;
- }
- }
- }
|