Esempio n. 1
0
        private static bool     CheckEmbeddableFile(Folder.File file)
        {
            Object[] references;
            Object   mainAsset;

            return(CheckEmbeddableFile(file, out references, out mainAsset));
        }
Esempio n. 2
0
        private void    Generate(string path)
        {
            string[] paths  = path.Split('/');
            Folder   folder = this.root;

            for (int i = 1; i < paths.Length - 1; i++)
            {
                int j   = 0;
                int max = folder.folders.Count;

                for (; j < max; j++)
                {
                    if (folder.folders[j].name == paths[i])
                    {
                        folder = folder.folders[j];
                        break;
                    }
                }

                if (j >= max)
                {
                    Folder newFolder = new Folder(folder, paths[i]);
                    folder.folders.Add(newFolder);
                    folder.folders.Sort((a, b) => a.name.CompareTo(b.name));
                    folder = newFolder;
                }
            }

            Folder.File f = new Folder.File(path, paths[paths.Length - 1]);
            if (existingList.Contains(f.path) == true)
            {
                f.referenced = true;
            }
            folder.files.Add(f);
            folder.files.Sort((a, b) => a.name.CompareTo(b.name));

            folder.Update(true);
        }
Esempio n. 3
0
        private static bool     CheckEmbeddableFile(Folder.File file, out Object[] references, out Object mainAsset)
        {
            bool containsNull = false;

            references = AssetDatabase.LoadAllAssetsAtPath(file.path);
            mainAsset  = AssetDatabase.LoadMainAssetAtPath(file.path);

            for (int i = 0; i < references.Length; i++)
            {
                if (references[i] == null)
                {
                    containsNull = true;
                    break;
                }
            }

            if (containsNull == true)
            {
                InternalNGDebug.LogWarning("Asset at \"" + file.path + "\" contains null assets. Fix them and reference again.", mainAsset);
                return(false);
            }

            if (references.Length == 0)
            {
                if (mainAsset != null)
                {
                    references = new Object[] { mainAsset }
                }
                ;
                else
                {
                    InternalNGDebug.LogWarning("Assets at \"" + file.path + "\" can not be embedded.");
                    return(false);
                }
            }

            return(true);
        }