BundleSystem.EditorAssetMap.IsAssetExist C# (CSharp) Method

IsAssetExist() public method

public IsAssetExist ( string bundleName, string assetName ) : bool
bundleName string
assetName string
return bool
        public bool IsAssetExist(string bundleName, string assetName)
        {
            var assets = GetAssetPaths(bundleName, assetName);
            return assets.Count > 0;
        }

Usage Example

        public static bool IsAssetExist(string bundleName, string assetName)
        {
#if UNITY_EDITOR
            if (UseAssetDatabase)
            {
                EnsureAssetDatabase();
                return(s_EditorAssetMap.IsAssetExist(bundleName, assetName));
            }
#endif
            if (!Initialized)
            {
                throw new System.Exception("BundleManager not initialized, try initialize first!");
            }
            if (!s_AssetBundles.TryGetValue(bundleName, out var foundBundle))
            {
                return(false);
            }
            return(foundBundle.Bundle.Contains(assetName));
        }