Exemple #1
0
        /// <summary>
        /// Loads all assets of this kind using AssetDatabase.
        /// </summary>
        public static List <T> FindAssetsByType <T>() where T : Object
        {
            List <T> assets = new List <T>();

            string[] paths = Relay.FindAssets <T>();
            for (int i = 0; i < paths.Length; i++)
            {
                string path  = paths[i];
                T      asset = Relay.LoadAssetAtPath <T>(path);
                if (asset != null)
                {
                    assets.Add(asset);
                }
            }

            return(assets);
        }
Exemple #2
0
 /// <summary>
 /// Loads the primary asset from this relative path.
 /// <code>
 /// Example: Prefabs/Projectiles/Bullet.prefab
 /// </code>
 /// </summary>
 public static Object LoadAssetAtPath(string path, Type type) => Relay.LoadAssetAtPath($"Assets/{path}", type);