using UnityEngine; using UnityEngine.SceneManagement; namespace Blocks4u.Runtime { public static class SceneUtilities { public static GameObject FindGameObjectByPath(string path) { foreach (var root in SceneManager.GetActiveScene().GetRootGameObjects()) { if (path == root.name) { return root; } if (!path.StartsWith(root.name + "/")) { continue; } foreach (Transform found in root.transform.Find(path.Substring(root.name.Length + 1))) { return found.gameObject; } } return null; } } }