From 31c2cebbccba45a00a755981dd6d0cdd0a0459e9 Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期二, 14 八月 2018 17:28:38 +0800
Subject: [PATCH] Merge branch 'master' into leonard

---
 Assets/Editor/Tool/CreateUIClassFile.cs |  574 ++++++++++++++++++++++++++++----------------------------
 1 files changed, 287 insertions(+), 287 deletions(-)

diff --git a/Assets/Editor/Tool/CreateUIClassFile.cs b/Assets/Editor/Tool/CreateUIClassFile.cs
index e4a1448..2a4794f 100644
--- a/Assets/Editor/Tool/CreateUIClassFile.cs
+++ b/Assets/Editor/Tool/CreateUIClassFile.cs
@@ -1,287 +1,287 @@
-锘縰sing System.Collections;
-using System.Collections.Generic;
-using UnityEditor.ProjectWindowCallback;
-using UnityEngine;
-using UnityEditor;
-using System;
-using System.IO;
-using System.Text;
-using System.Text.RegularExpressions;
-
-public class CreateUIClassFile
-{
-
-    static string templatePath = "Assets/Editor/ScriptTemplate/UIMonobehaviorScriptTemplate.txt";
-
-    [MenuItem("Assets/Create/Custom C# Script/UIBehaviour", false, 4)]
-    public static void CreateUIClass()
-    {
-        var newConfigPath = GetSelectedPathOrFallback() + "/NewUIBehaviour.cs";
-        AssetDatabase.DeleteAsset(newConfigPath);
-        ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, ScriptableObject.CreateInstance<UIClassTemplate>(), newConfigPath, null, templatePath);
-    }
-
-    public static string GetSelectedPathOrFallback()
-    {
-        string path = "Assets";
-        foreach (UnityEngine.Object obj in Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.Assets))
-        {
-            path = AssetDatabase.GetAssetPath(obj);
-            if (!string.IsNullOrEmpty(path) && File.Exists(path))
-            {
-                path = Path.GetDirectoryName(path);
-                break;
-            }
-        }
-        return path;
-    }
-
-}
-
-class UIClassTemplate : EndNameEditAction
-{
-
-    public override void Action(int instanceId, string pathName, string resourceFile)
-    {
-        UnityEngine.Object o = CreateScriptAssetFromTemplate(pathName, resourceFile);
-        ProjectWindowUtil.ShowCreatedAsset(o);
-    }
-
-    internal static UnityEngine.Object CreateScriptAssetFromTemplate(string pathName, string resourceFile)
-    {
-        string fullPath = Path.GetFullPath(pathName);
-
-        StreamReader streamReader = new StreamReader(resourceFile);
-        string text = streamReader.ReadToEnd();
-        streamReader.Close();
-        string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(pathName);
-        text = Regex.Replace(text, "#ClassName*#", fileNameWithoutExtension);
-        text = Regex.Replace(text, "#DateTime#", System.DateTime.Now.ToLongDateString());
-
-        bool encoderShouldEmitUTF8Identifier = true;
-        bool throwOnInvalidBytes = false;
-        UTF8Encoding encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier, throwOnInvalidBytes);
-        bool append = false;
-        StreamWriter streamWriter = new StreamWriter(fullPath, append, encoding);
-        streamWriter.Write(text);
-        streamWriter.Close();
-        AssetDatabase.ImportAsset(pathName);
-        return AssetDatabase.LoadAssetAtPath(pathName, typeof(UnityEngine.Object));
-    }
-
-}
-
-
-public class CreateUIWindowClassFile
-{
-
-    static string templatePath = "Assets/Editor/ScriptTemplate/WindowTemplate.txt";
-
-    [MenuItem("Assets/Create/Custom C# Script/Window", false, 5)]
-    public static void CreateUIClass()
-    {
-        var newConfigPath = GetSelectedPathOrFallback() + "/NewWindow.cs";
-        AssetDatabase.DeleteAsset(newConfigPath);
-        ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, ScriptableObject.CreateInstance<UIWindowTemplate>(), newConfigPath, null, templatePath);
-    }
-
-    public static string GetSelectedPathOrFallback()
-    {
-        string path = "Assets";
-        foreach (UnityEngine.Object obj in Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.Assets))
-        {
-            path = AssetDatabase.GetAssetPath(obj);
-            if (!string.IsNullOrEmpty(path) && File.Exists(path))
-            {
-                path = Path.GetDirectoryName(path);
-                break;
-            }
-        }
-        return path;
-    }
-
-}
-
-class UIWindowTemplate : EndNameEditAction
-{
-
-    public override void Action(int instanceId, string pathName, string resourceFile)
-    {
-        UnityEngine.Object o = CreateScriptAssetFromTemplate(pathName, resourceFile);
-        ProjectWindowUtil.ShowCreatedAsset(o);
-    }
-
-    internal static UnityEngine.Object CreateScriptAssetFromTemplate(string pathName, string resourceFile)
-    {
-        string fullPath = Path.GetFullPath(pathName);
-
-        StreamReader streamReader = new StreamReader(resourceFile);
-        string text = streamReader.ReadToEnd();
-        streamReader.Close();
-        string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(pathName);
-        text = Regex.Replace(text, "#ClassName*#", fileNameWithoutExtension);
-        text = Regex.Replace(text, "#DateTime#", System.DateTime.Now.ToLongDateString());
-
-        bool encoderShouldEmitUTF8Identifier = true;
-        bool throwOnInvalidBytes = false;
-        UTF8Encoding encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier, throwOnInvalidBytes);
-        bool append = false;
-        StreamWriter streamWriter = new StreamWriter(fullPath, append, encoding);
-        streamWriter.Write(text);
-        streamWriter.Close();
-        AssetDatabase.ImportAsset(pathName);
-        return AssetDatabase.LoadAssetAtPath(pathName, typeof(UnityEngine.Object));
-    }
-
-}
-
-
-public class CreateDTCClassFile
-{
-
-    static string templatePath = "Assets/Editor/ScriptTemplate/DataToCotrollerTemplate.txt";
-
-    [MenuItem("Assets/Create/Custom C# Script/DTC", false, 6)]
-    public static void CreateUIClass()
-    {
-        var newConfigPath = GetSelectedPathOrFallback() + "/NewDTC.cs";
-        AssetDatabase.DeleteAsset(newConfigPath);
-        ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, ScriptableObject.CreateInstance<DTCTemplate>(), newConfigPath, null, templatePath);
-    }
-
-    public static string GetSelectedPathOrFallback()
-    {
-        string path = "Assets";
-        foreach (UnityEngine.Object obj in Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.Assets))
-        {
-            path = AssetDatabase.GetAssetPath(obj);
-            if (!string.IsNullOrEmpty(path) && File.Exists(path))
-            {
-                path = Path.GetDirectoryName(path);
-                break;
-            }
-        }
-        return path;
-    }
-
-}
-
-class DTCTemplate : EndNameEditAction
-{
-
-    public override void Action(int instanceId, string pathName, string resourceFile)
-    {
-        UnityEngine.Object o = CreateScriptAssetFromTemplate(pathName, resourceFile);
-        AddPackageRigster(pathName);
-        ProjectWindowUtil.ShowCreatedAsset(o);
-    }
-
-    internal static UnityEngine.Object CreateScriptAssetFromTemplate(string pathName, string resourceFile)
-    {
-        string fullPath = Path.GetFullPath(pathName);
-
-        StreamReader streamReader = new StreamReader(resourceFile);
-        string text = streamReader.ReadToEnd();
-        streamReader.Close();
-        string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(pathName);
-        text = Regex.Replace(text, "#ClassName*#", fileNameWithoutExtension);
-        text = Regex.Replace(text, "#DateTime#", System.DateTime.Now.ToLongDateString());
-        text = Regex.Replace(text, "#ServerPackage#", fileNameWithoutExtension.Replace("DTC", ""));
-
-        bool encoderShouldEmitUTF8Identifier = true;
-        bool throwOnInvalidBytes = false;
-        UTF8Encoding encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier, throwOnInvalidBytes);
-        bool append = false;
-        StreamWriter streamWriter = new StreamWriter(fullPath, append, encoding);
-        streamWriter.Write(text);
-        streamWriter.Close();
-        AssetDatabase.ImportAsset(pathName);
-        return AssetDatabase.LoadAssetAtPath(pathName, typeof(UnityEngine.Object));
-    }
-
-    internal static void AddPackageRigster(string _pathName)
-    {
-        string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(_pathName);
-        string packageName = fileNameWithoutExtension.Replace("DTC", "H");
-        string add = string.Format("Register(typeof({0}), typeof({1}));", packageName, fileNameWithoutExtension);
-
-        string path = Application.dataPath + "/Scripts/Core/GameEngine/DataToCtl/PackageRegedit.cs";
-        var text = File.ReadAllText(path);
-
-        if (!text.Contains(add))
-        {
-            text = text.Replace("鐧昏鐩稿簲鐨勬暟鎹綋鍙婂搴旂殑鏁版嵁杞�昏緫绫籠r\n", "鐧昏鐩稿簲鐨勬暟鎹綋鍙婂搴旂殑鏁版嵁杞�昏緫绫籠r\n" + "\t\t" + add + "\r\n");
-        }
-
-        bool encoderShouldEmitUTF8Identifier = true;
-        bool throwOnInvalidBytes = false;
-        UTF8Encoding encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier, throwOnInvalidBytes);
-        bool append = false;
-        StreamWriter streamWriter = new StreamWriter(path, append, encoding);
-        streamWriter.Write(text);
-        streamWriter.Close();
-        AssetDatabase.ImportAsset(path);
-
-    }
-
-    static string templatePath = "Assets/Editor/ScriptTemplate/ShaderPattern.txt";
-
-    [MenuItem("Assets/Create/Shader/VF Shader", false, 4)]
-    public static void CreateUIClass()
-    {
-        var newConfigPath = GetSelectedPathOrFallback() + "/VF Shader.Shader";
-        AssetDatabase.DeleteAsset(newConfigPath);
-        ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, ScriptableObject.CreateInstance<VFShaderTemplate>(), newConfigPath, null, templatePath);
-    }
-
-    public static string GetSelectedPathOrFallback()
-    {
-        string path = "Assets";
-        foreach (UnityEngine.Object obj in Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.Assets))
-        {
-            path = AssetDatabase.GetAssetPath(obj);
-            if (!string.IsNullOrEmpty(path) && File.Exists(path))
-            {
-                path = Path.GetDirectoryName(path);
-                break;
-            }
-        }
-        return path;
-    }
-
-}
-
-class VFShaderTemplate : EndNameEditAction
-{
-
-    public override void Action(int instanceId, string pathName, string resourceFile)
-    {
-        UnityEngine.Object o = CreateScriptAssetFromTemplate(pathName, resourceFile);
-        ProjectWindowUtil.ShowCreatedAsset(o);
-    }
-
-    internal static UnityEngine.Object CreateScriptAssetFromTemplate(string pathName, string resourceFile)
-    {
-        string fullPath = Path.GetFullPath(pathName);
-
-        StreamReader streamReader = new StreamReader(resourceFile);
-        string text = streamReader.ReadToEnd();
-        streamReader.Close();
-        string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(pathName);
-        var names = fileNameWithoutExtension.Split('_');
-
-        text = Regex.Replace(text, "#NAME*#", names.Length > 0 ? names[0] : string.Empty);
-        text = Regex.Replace(text, "#Character#", names.Length > 1 ? names[1] : string.Empty);
-
-        bool encoderShouldEmitUTF8Identifier = true;
-        bool throwOnInvalidBytes = false;
-        UTF8Encoding encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier, throwOnInvalidBytes);
-        bool append = false;
-        StreamWriter streamWriter = new StreamWriter(fullPath, append, encoding);
-        streamWriter.Write(text);
-        streamWriter.Close();
-        AssetDatabase.ImportAsset(pathName);
-        return AssetDatabase.LoadAssetAtPath(pathName, typeof(UnityEngine.Object));
-    }
-
-}
+锘縰sing System.Collections;
+using System.Collections.Generic;
+using UnityEditor.ProjectWindowCallback;
+using UnityEngine;
+using UnityEditor;
+using System;
+using System.IO;
+using System.Text;
+using System.Text.RegularExpressions;
+
+public class CreateUIClassFile
+{
+
+    static string templatePath = "Assets/Editor/ScriptTemplate/UIMonobehaviorScriptTemplate.txt";
+
+    [MenuItem("Assets/Create/Custom C# Script/UIBehaviour", false, 4)]
+    public static void CreateUIClass()
+    {
+        var newConfigPath = GetSelectedPathOrFallback() + "/NewUIBehaviour.cs";
+        AssetDatabase.DeleteAsset(newConfigPath);
+        ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, ScriptableObject.CreateInstance<UIClassTemplate>(), newConfigPath, null, templatePath);
+    }
+
+    public static string GetSelectedPathOrFallback()
+    {
+        string path = "Assets";
+        foreach (UnityEngine.Object obj in Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.Assets))
+        {
+            path = AssetDatabase.GetAssetPath(obj);
+            if (!string.IsNullOrEmpty(path) && File.Exists(path))
+            {
+                path = Path.GetDirectoryName(path);
+                break;
+            }
+        }
+        return path;
+    }
+
+}
+
+class UIClassTemplate : EndNameEditAction
+{
+
+    public override void Action(int instanceId, string pathName, string resourceFile)
+    {
+        UnityEngine.Object o = CreateScriptAssetFromTemplate(pathName, resourceFile);
+        ProjectWindowUtil.ShowCreatedAsset(o);
+    }
+
+    internal static UnityEngine.Object CreateScriptAssetFromTemplate(string pathName, string resourceFile)
+    {
+        string fullPath = Path.GetFullPath(pathName);
+
+        StreamReader streamReader = new StreamReader(resourceFile);
+        string text = streamReader.ReadToEnd();
+        streamReader.Close();
+        string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(pathName);
+        text = Regex.Replace(text, "#ClassName*#", fileNameWithoutExtension);
+        text = Regex.Replace(text, "#DateTime#", System.DateTime.Now.ToLongDateString());
+
+        bool encoderShouldEmitUTF8Identifier = true;
+        bool throwOnInvalidBytes = false;
+        UTF8Encoding encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier, throwOnInvalidBytes);
+        bool append = false;
+        StreamWriter streamWriter = new StreamWriter(fullPath, append, encoding);
+        streamWriter.Write(text);
+        streamWriter.Close();
+        AssetDatabase.ImportAsset(pathName);
+        return AssetDatabase.LoadAssetAtPath(pathName, typeof(UnityEngine.Object));
+    }
+
+}
+
+
+public class CreateUIWindowClassFile
+{
+
+    static string templatePath = "Assets/Editor/ScriptTemplate/WindowTemplate.txt";
+
+    [MenuItem("Assets/Create/Custom C# Script/Window", false, 5)]
+    public static void CreateUIClass()
+    {
+        var newConfigPath = GetSelectedPathOrFallback() + "/NewWindow.cs";
+        AssetDatabase.DeleteAsset(newConfigPath);
+        ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, ScriptableObject.CreateInstance<UIWindowTemplate>(), newConfigPath, null, templatePath);
+    }
+
+    public static string GetSelectedPathOrFallback()
+    {
+        string path = "Assets";
+        foreach (UnityEngine.Object obj in Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.Assets))
+        {
+            path = AssetDatabase.GetAssetPath(obj);
+            if (!string.IsNullOrEmpty(path) && File.Exists(path))
+            {
+                path = Path.GetDirectoryName(path);
+                break;
+            }
+        }
+        return path;
+    }
+
+}
+
+class UIWindowTemplate : EndNameEditAction
+{
+
+    public override void Action(int instanceId, string pathName, string resourceFile)
+    {
+        UnityEngine.Object o = CreateScriptAssetFromTemplate(pathName, resourceFile);
+        ProjectWindowUtil.ShowCreatedAsset(o);
+    }
+
+    internal static UnityEngine.Object CreateScriptAssetFromTemplate(string pathName, string resourceFile)
+    {
+        string fullPath = Path.GetFullPath(pathName);
+
+        StreamReader streamReader = new StreamReader(resourceFile);
+        string text = streamReader.ReadToEnd();
+        streamReader.Close();
+        string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(pathName);
+        text = Regex.Replace(text, "#ClassName*#", fileNameWithoutExtension);
+        text = Regex.Replace(text, "#DateTime#", System.DateTime.Now.ToLongDateString());
+
+        bool encoderShouldEmitUTF8Identifier = true;
+        bool throwOnInvalidBytes = false;
+        UTF8Encoding encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier, throwOnInvalidBytes);
+        bool append = false;
+        StreamWriter streamWriter = new StreamWriter(fullPath, append, encoding);
+        streamWriter.Write(text);
+        streamWriter.Close();
+        AssetDatabase.ImportAsset(pathName);
+        return AssetDatabase.LoadAssetAtPath(pathName, typeof(UnityEngine.Object));
+    }
+
+}
+
+
+public class CreateDTCClassFile
+{
+
+    static string templatePath = "Assets/Editor/ScriptTemplate/DataToCotrollerTemplate.txt";
+
+    [MenuItem("Assets/Create/Custom C# Script/DTC", false, 6)]
+    public static void CreateUIClass()
+    {
+        var newConfigPath = GetSelectedPathOrFallback() + "/NewDTC.cs";
+        AssetDatabase.DeleteAsset(newConfigPath);
+        ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, ScriptableObject.CreateInstance<DTCTemplate>(), newConfigPath, null, templatePath);
+    }
+
+    public static string GetSelectedPathOrFallback()
+    {
+        string path = "Assets";
+        foreach (UnityEngine.Object obj in Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.Assets))
+        {
+            path = AssetDatabase.GetAssetPath(obj);
+            if (!string.IsNullOrEmpty(path) && File.Exists(path))
+            {
+                path = Path.GetDirectoryName(path);
+                break;
+            }
+        }
+        return path;
+    }
+
+}
+
+class DTCTemplate : EndNameEditAction
+{
+
+    public override void Action(int instanceId, string pathName, string resourceFile)
+    {
+        UnityEngine.Object o = CreateScriptAssetFromTemplate(pathName, resourceFile);
+        AddPackageRigster(pathName);
+        ProjectWindowUtil.ShowCreatedAsset(o);
+    }
+
+    internal static UnityEngine.Object CreateScriptAssetFromTemplate(string pathName, string resourceFile)
+    {
+        string fullPath = Path.GetFullPath(pathName);
+
+        StreamReader streamReader = new StreamReader(resourceFile);
+        string text = streamReader.ReadToEnd();
+        streamReader.Close();
+        string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(pathName);
+        text = Regex.Replace(text, "#ClassName*#", fileNameWithoutExtension);
+        text = Regex.Replace(text, "#DateTime#", System.DateTime.Now.ToLongDateString());
+        text = Regex.Replace(text, "#ServerPackage#", fileNameWithoutExtension.Replace("DTC", ""));
+
+        bool encoderShouldEmitUTF8Identifier = true;
+        bool throwOnInvalidBytes = false;
+        UTF8Encoding encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier, throwOnInvalidBytes);
+        bool append = false;
+        StreamWriter streamWriter = new StreamWriter(fullPath, append, encoding);
+        streamWriter.Write(text);
+        streamWriter.Close();
+        AssetDatabase.ImportAsset(pathName);
+        return AssetDatabase.LoadAssetAtPath(pathName, typeof(UnityEngine.Object));
+    }
+
+    internal static void AddPackageRigster(string _pathName)
+    {
+        string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(_pathName);
+        string packageName = fileNameWithoutExtension.Replace("DTC", "H");
+        string add = string.Format("Register(typeof({0}), typeof({1}));", packageName, fileNameWithoutExtension);
+
+        string path = Application.dataPath + "/Scripts/Core/GameEngine/DataToCtl/PackageRegedit.cs";
+        var text = File.ReadAllText(path);
+
+        if (!text.Contains(add))
+        {
+            text = text.Replace("鐧昏鐩稿簲鐨勬暟鎹綋鍙婂搴旂殑鏁版嵁杞�昏緫绫籠r\n", "鐧昏鐩稿簲鐨勬暟鎹綋鍙婂搴旂殑鏁版嵁杞�昏緫绫籠r\n" + "\t\t" + add + "\r\n");
+        }
+
+        bool encoderShouldEmitUTF8Identifier = true;
+        bool throwOnInvalidBytes = false;
+        UTF8Encoding encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier, throwOnInvalidBytes);
+        bool append = false;
+        StreamWriter streamWriter = new StreamWriter(path, append, encoding);
+        streamWriter.Write(text);
+        streamWriter.Close();
+        AssetDatabase.ImportAsset(path);
+
+    }
+
+    static string templatePath = "Assets/Editor/ScriptTemplate/ShaderPattern.txt";
+
+    [MenuItem("Assets/Create/Shader/VF Shader", false, 4)]
+    public static void CreateUIClass()
+    {
+        var newConfigPath = GetSelectedPathOrFallback() + "/VF Shader.Shader";
+        AssetDatabase.DeleteAsset(newConfigPath);
+        ProjectWindowUtil.StartNameEditingIfProjectWindowExists(0, ScriptableObject.CreateInstance<VFShaderTemplate>(), newConfigPath, null, templatePath);
+    }
+
+    public static string GetSelectedPathOrFallback()
+    {
+        string path = "Assets";
+        foreach (UnityEngine.Object obj in Selection.GetFiltered(typeof(UnityEngine.Object), SelectionMode.Assets))
+        {
+            path = AssetDatabase.GetAssetPath(obj);
+            if (!string.IsNullOrEmpty(path) && File.Exists(path))
+            {
+                path = Path.GetDirectoryName(path);
+                break;
+            }
+        }
+        return path;
+    }
+
+}
+
+class VFShaderTemplate : EndNameEditAction
+{
+
+    public override void Action(int instanceId, string pathName, string resourceFile)
+    {
+        UnityEngine.Object o = CreateScriptAssetFromTemplate(pathName, resourceFile);
+        ProjectWindowUtil.ShowCreatedAsset(o);
+    }
+
+    internal static UnityEngine.Object CreateScriptAssetFromTemplate(string pathName, string resourceFile)
+    {
+        string fullPath = Path.GetFullPath(pathName);
+
+        StreamReader streamReader = new StreamReader(resourceFile);
+        string text = streamReader.ReadToEnd();
+        streamReader.Close();
+        string fileNameWithoutExtension = Path.GetFileNameWithoutExtension(pathName);
+        var names = fileNameWithoutExtension.Split('_');
+
+        text = Regex.Replace(text, "#NAME*#", names.Length > 0 ? names[0] : string.Empty);
+        text = Regex.Replace(text, "#Character#", names.Length > 1 ? names[1] : string.Empty);
+
+        bool encoderShouldEmitUTF8Identifier = true;
+        bool throwOnInvalidBytes = false;
+        UTF8Encoding encoding = new UTF8Encoding(encoderShouldEmitUTF8Identifier, throwOnInvalidBytes);
+        bool append = false;
+        StreamWriter streamWriter = new StreamWriter(fullPath, append, encoding);
+        streamWriter.Write(text);
+        streamWriter.Close();
+        AssetDatabase.ImportAsset(pathName);
+        return AssetDatabase.LoadAssetAtPath(pathName, typeof(UnityEngine.Object));
+    }
+
+}

--
Gitblit v1.8.0