internal static Object CreateScriptAssetWithContent(string pathName, string templateContent) { AssetModificationProcessorInternal.OnWillCreateAsset(pathName); templateContent = SetLineEndings(templateContent, EditorSettings.lineEndingsForNewScripts); string fullPath = Path.GetFullPath(pathName); File.WriteAllText(fullPath, templateContent); // Import the asset AssetDatabase.ImportAsset(pathName); return(AssetDatabase.LoadAssetAtPath(pathName, typeof(Object))); }