예제 #1
0
        public static SceneList CreateAssetAtPath(string path)
        {
            SceneList asset = ScriptableObject.CreateInstance <SceneList>();

            asset.name = Path.GetFileName(path);
            AssetDatabase.CreateAsset(asset, path);
            return(asset);
        }
        void PopulateAssets()
        {
            var buildTemplates = AssetDatabase.FindAssets("t:BuildTemplate");
            var buildProfiles  = AssetDatabase.FindAssets("t:BuildProfile");
            var sceneLists     = AssetDatabase.FindAssets("t:SceneList");

            m_BuildTemplates = new Dictionary <string, List <BuildTemplate> >();
            m_BuildProfiles  = new List <BuildProfile>();
            m_SceneLists     = new List <SceneList>();


            foreach (var templateGUID in buildTemplates)
            {
                string        templatePath = AssetDatabase.GUIDToAssetPath(templateGUID);
                BuildTemplate template     = (BuildTemplate)AssetDatabase.LoadAssetAtPath(templatePath, typeof(BuildTemplate));
                if (!m_BuildTemplates.ContainsKey(template.Category))
                {
                    m_BuildTemplates.Add(template.Category, new List <BuildTemplate>());
                }

                m_BuildTemplates[template.Category].Add(template);
            }


            foreach (var profileGUID in buildProfiles)
            {
                string       profilePath = AssetDatabase.GUIDToAssetPath(profileGUID);
                BuildProfile profile     = (BuildProfile)AssetDatabase.LoadAssetAtPath(profilePath, typeof(BuildProfile));
                m_BuildProfiles.Add(profile);
            }

            foreach (var sceneListGUID in sceneLists)
            {
                string    sceneListPath = AssetDatabase.GUIDToAssetPath(sceneListGUID);
                SceneList sceneList     = (SceneList)AssetDatabase.LoadAssetAtPath(sceneListPath, typeof(SceneList));
                m_SceneLists.Add(sceneList);
            }
        }
예제 #3
0
        public override void Action(int instanceId, string pathName, string resourceFile)
        {
            SceneList asset = SceneListAssetFactory.CreateAssetAtPath(pathName);

            ProjectWindowUtil.ShowCreatedAsset(asset);
        }