예제 #1
0
        internal static UnityEngine.Object CreateScriptAssetWithContent(string pathName, string templateContent)
        {
            templateContent = ProjectWindowUtil.SetLineEndings(templateContent, EditorSettings.lineEndingsForNewScripts);
            string       fullPath = Path.GetFullPath(pathName);
            UTF8Encoding encoding = new UTF8Encoding(true);

            File.WriteAllText(fullPath, templateContent, encoding);
            AssetDatabase.ImportAsset(pathName);
            return(AssetDatabase.LoadAssetAtPath(pathName, typeof(UnityEngine.Object)));
        }