示例#1
0
        private void CreateScript()
        {
            var basePath     = Path.Combine(EditorApplication.applicationContentsPath, kResourcesTemplatePath);
            var templatePath = Path.Combine(basePath, "81-C# Script-NewBehaviourScript.cs.txt");

            ProjectWindowUtil.CreateScriptAssetFromTemplate(TargetPath(), templatePath);
            AssetDatabase.Refresh();
        }
示例#2
0
        internal static MonoScript CreateNewSceneTemplatePipelineAtPath(string filePath)
        {
            if (string.IsNullOrEmpty(filePath))
            {
                return(null);
            }

            var templatePath = AssetsMenuUtility.GetScriptTemplatePath(ScriptTemplate.CSharp_NewSceneTemplatePipelineScript);
            var scriptAsset  = ProjectWindowUtil.CreateScriptAssetFromTemplate(filePath, templatePath) as MonoScript;

            scriptAsset?.SetScriptTypeWasJustCreatedFromComponentMenu();
            AssetDatabase.Refresh();
            return(scriptAsset);
        }
        public override void Action(int instanceId, string pathName, string resourceFile)
        {
            string fileName = Path.GetFileName(pathName);
            string guid     = AssetDatabase.CreateFolder(Path.GetDirectoryName(pathName), fileName);
            string path     = Path.Combine(EditorApplication.applicationContentsPath, "Resources/ScriptTemplates");

            foreach (string current in (this.templates ?? Enumerable.Empty <string>()))
            {
                string path2     = current.Replace(".txt", string.Empty);
                string extension = Path.GetExtension(path2);
                ProjectWindowUtil.CreateScriptAssetFromTemplate(Path.Combine(pathName, fileName + extension), Path.Combine(path, current));
            }
            UnityEngine.Object o = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(guid), typeof(UnityEngine.Object));
            ProjectWindowUtil.ShowCreatedAsset(o);
        }
示例#4
0
            public override void Action(int instanceId, string pathName, string resourceFile)
            {
                var    fileName = Path.GetFileName(pathName);
                string guid     = AssetDatabase.CreateFolder(Path.GetDirectoryName(pathName), fileName);
                string basePath = Path.Combine(EditorApplication.applicationContentsPath, kResourcesTemplatePath);

                foreach (var template in templates ?? Enumerable.Empty <string>())
                {
                    var templateNameWithoutTxt = template.Replace(".txt", string.Empty);
                    var templateExtension      = Path.GetExtension(templateNameWithoutTxt);

                    ProjectWindowUtil.CreateScriptAssetFromTemplate(Path.Combine(pathName, fileName + templateExtension), Path.Combine(basePath, template));
                }

                UnityEngine.Object o = AssetDatabase.LoadAssetAtPath(AssetDatabase.GUIDToAssetPath(guid), typeof(UnityEngine.Object));
                ProjectWindowUtil.ShowCreatedAsset(o);
            }
示例#5
0
 public override void Action(int instanceId, string pathName, string resourceFile)
 {
     ProjectWindowUtil.ShowCreatedAsset(ProjectWindowUtil.CreateScriptAssetFromTemplate(pathName, resourceFile));
 }
 private void CreateScript()
 {
     ProjectWindowUtil.CreateScriptAssetFromTemplate(this.TargetPath(), this.templatePath);
     AssetDatabase.Refresh();
 }
示例#7
0
 public override void Action(int instanceId, string pathName, string resourceFile)
 {
     UnityEngine.Object o = ProjectWindowUtil.CreateScriptAssetFromTemplate(pathName, resourceFile);
     ProjectWindowUtil.ShowCreatedAsset(o);
 }