Ejemplo n.º 1
0
    static List <string> filterScenes(string[] scenes, List <string> includeTags, List <string> requireTags, List <string> excludeTags)
    {
        var filtered = new List <string>();

        foreach (var scene in scenes)
        {
            SamplesSceneSettings settings = GetSceneSettings(scene);
            if (settings)
            {
                bool include = false;
                foreach (var tag in includeTags)
                {
                    if (settings.HasTag(tag))
                    {
                        include = true;
                    }
                }
                if (include)
                {
                    foreach (var tag in requireTags)
                    {
                        if (!settings.HasTag(tag))
                        {
                            include = false;
                        }
                    }
                }
                if (include)
                {
                    foreach (var tag in excludeTags)
                    {
                        if (settings.HasTag(tag))
                        {
                            include = false;
                        }
                    }
                }
                if (include)
                {
                    filtered.Add(scene);
                }
            }
        }
        return(filtered);
    }
Ejemplo n.º 2
0
    static SamplesSceneSettings GetSceneSettings(string path)
    {
        SamplesSceneSettings settings = null;
        int li = path.LastIndexOf(".");

        if (li >= 0)
        {
            string settingsPath = path.Substring(0, li) + ".asset";
            settings = (SamplesSceneSettings)AssetDatabase.LoadAssetAtPath(settingsPath, typeof(SamplesSceneSettings));
            if (settings == null)
            {
                Debug.LogError(string.Format("No settings file for scene {0}. Creating settings file.", path));


                CustomAssetUtility.CreateAsset <SamplesSceneSettings>(settingsPath);
            }
        }
        else
        {
            Debug.LogError(string.Format("Unexpected scene path : {0}", path));
        }
        return(settings);
    }