/// <summary> /// Finds the GameObject with the matching name in the object pool, or if not pooled, from the path. /// </summary> /// <param name="nameWithPath">The name of the prefab, including the path.</param> /// <returns>The uninstantiated GameObject that matches the path, if found. If no GameObject is found, returns null.</returns> public static void GetGameObjectAsync(string nameWithPath, System.Action <string, GameObject> callback) { GameObject gameObject = null; if (!string.IsNullOrEmpty(nameWithPath)) { //Instance._cache.TryGetValue(nameWithPath, out gameObject); if (gameObject == null) { System.Action <string, GameObject> internalCallback = (path, asset) => { //if (gameObject != null && Instance.m_autoCacheLoadedPrefabs) // Instance._cache[nameWithPath] = gameObject; if (callback != null) { callback(path, asset); } }; var addressAsset = ResourcePrefabs.GetPrefabAddressWithName(nameWithPath); if (addressAsset != null && !addressAsset.IsEmpty()) { ResourcesLoader.LoadAsync(addressAsset, internalCallback); } else { ResourcesLoader.LoadAsync <GameObject>(nameWithPath, internalCallback); } } } else { callback(nameWithPath, null); } }