This commit is contained in:
JohnCorby 2025-02-13 20:32:21 -08:00
parent 89a58c2a93
commit ece07be2d6

View File

@ -127,13 +127,13 @@ namespace NewHorizons.Utility
} }
Profiler.EndSample(); Profiler.EndSample();
Profiler.BeginSample("1"); Profiler.BeginSample("2");
// 2: find inactive using root + transform.find // 2: find inactive using root + transform.find
var names = path.Split('/'); var names = path.Split('/');
// Cache the root objects so we don't loop through all of them each time // Cache the root objects so we don't loop through all of them each time
var rootName = names[0]; var rootName = names[0];
if (!CachedRootGameObjects.TryGetValue(rootName, out var root)) if (!CachedRootGameObjects.TryGetValue(rootName, out var root))
{ {
root = SceneManager.GetActiveScene().GetRootGameObjects().FirstOrDefault(x => x.name == rootName); root = SceneManager.GetActiveScene().GetRootGameObjects().FirstOrDefault(x => x.name == rootName);
if (root != null) if (root != null)