From dcde8902f1422ee775e90b5f1727d57048684801 Mon Sep 17 00:00:00 2001 From: Perfare Date: Sun, 15 Jan 2017 19:57:41 +0800 Subject: [PATCH] support Unity 5.5 --- Unity Studio/AssetsFile.cs | 48 +++- Unity Studio/ClassIDReference.cs | 3 + Unity Studio/EndianStream.cs | 32 +-- Unity Studio/Unity Classes/Font.cs | 229 +++++++++++------- Unity Studio/Unity Classes/PlayerSettings.cs | 9 + Unity Studio/Unity Classes/Shader.cs | 74 ++++++ .../Unity Classes/SkinnedMeshRenderer.cs | 25 +- Unity Studio/Unity Classes/Texture2D.cs | 4 +- Unity Studio/Unity Studio.csproj | 1 + Unity Studio/UnityStudioForm.cs | 28 ++- 10 files changed, 324 insertions(+), 129 deletions(-) create mode 100644 Unity Studio/Unity Classes/Shader.cs diff --git a/Unity Studio/AssetsFile.cs b/Unity Studio/AssetsFile.cs index 199f819..5825aa7 100644 --- a/Unity Studio/AssetsFile.cs +++ b/Unity Studio/AssetsFile.cs @@ -1,9 +1,7 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.IO; -//using System.Diagnostics; //remove this later +using System.Text; namespace Unity_Studio { @@ -31,6 +29,7 @@ namespace Unity_Studio public SortedDictionary ClassStructures = new SortedDictionary(); private bool baseDefinitions = false; + private List classIDs = new List();//use for 5.5.0 public class UnityShared { @@ -84,7 +83,9 @@ namespace Unity_Studio break; } case 14://5.0.0 beta and final - case 15://5.0.1 and up + case 15://5.0.1 - 5.4 + case 16://??.. no sure + case 17://5.5.0 and up { a_Stream.Position += 4;//azero m_Version = a_Stream.ReadStringToNull(); @@ -94,7 +95,7 @@ namespace Unity_Studio } default: { - //MessageBox.Show("Unsupported Unity version!", "Unity Studio Error", MessageBoxButtons.OK, MessageBoxIcon.Error); + //MessageBox.Show("Unsupported Unity version!" + fileGen, "Unity Studio Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } } @@ -163,10 +164,19 @@ namespace Unity_Studio asset.Offset = a_Stream.ReadInt32(); asset.Offset += dataOffset; asset.Size = a_Stream.ReadInt32(); - asset.Type1 = a_Stream.ReadInt32(); - asset.Type2 = a_Stream.ReadUInt16(); - a_Stream.Position += 2; - if (fileGen >= 15) + if (fileGen > 15) + { + int index = a_Stream.ReadInt32(); + asset.Type1 = classIDs[index][0]; + asset.Type2 = (ushort)classIDs[index][1]; + } + else + { + asset.Type1 = a_Stream.ReadInt32(); + asset.Type2 = a_Stream.ReadUInt16(); + a_Stream.Position += 2; + } + if (fileGen == 15) { byte unknownByte = a_Stream.ReadByte(); //this is a single byte, not an int32 @@ -184,7 +194,7 @@ namespace Unity_Studio } else { - asset.TypeString = "unknown"; + asset.TypeString = "Unknown Type " + asset.Type2; } asset.uniqueID = i.ToString(assetIDfmt); @@ -258,6 +268,21 @@ namespace Unity_Studio { int classID = a_Stream.ReadInt32(); if (classID < 0) { a_Stream.Position += 16; } + if (fileGen > 15) + { + a_Stream.ReadByte(); + int type1; + if ((type1 = a_Stream.ReadInt16()) >= 0) + { + type1 = -1 - type1; + a_Stream.Position += 16; + } + else + { + type1 = classID; + } + classIDs.Add(new int[] { type1, classID }); + } a_Stream.Position += 16; if (baseDefinitions) @@ -357,7 +382,7 @@ namespace Unity_Studio int num1 = a_Stream.ReadInt32(); if (index == 0) { className = varTypeStr + " " + varNameStr; } - else { classVarStr.AppendFormat("{0}{1} {2} {3}\r\n", (new string('\t', level)), varTypeStr, varNameStr, size); } + else { classVarStr.AppendFormat("{0}{1} {2} {3}\r\n", (new string('\t', level - 1)), varTypeStr, varNameStr, size); } //for (int t = 0; t < level; t++) { Debug.Write("\t"); } //Debug.WriteLine(varTypeStr + " " + varNameStr + " " + size); @@ -368,7 +393,6 @@ namespace Unity_Studio aClass.SubItems.Add(classID.ToString()); ClassStructures.Add(classID, aClass); } - } } diff --git a/Unity Studio/ClassIDReference.cs b/Unity Studio/ClassIDReference.cs index 388daeb..77cb25d 100644 --- a/Unity Studio/ClassIDReference.cs +++ b/Unity Studio/ClassIDReference.cs @@ -208,6 +208,9 @@ namespace Unity_Studio Names[272] = "AudioMixerSnapshot"; Names[273] = "AudioMixerGroup"; Names[290] = "AssetBundleManifest"; + Names[300] = "RuntimeInitializeOnLoadManager"; + Names[301] = "CloudWebServicesManager"; + Names[310] = "UnityConnectSettings"; Names[1001] = "Prefab"; Names[1002] = "EditorExtensionImpl"; Names[1003] = "AssetImporter"; diff --git a/Unity Studio/EndianStream.cs b/Unity Studio/EndianStream.cs index 8227573..c29dba8 100644 --- a/Unity Studio/EndianStream.cs +++ b/Unity Studio/EndianStream.cs @@ -54,7 +54,7 @@ namespace Unity_Studio { return base.ReadChar(); } - + public override Int16 ReadInt16() { if (endian == EndianType.BigEndian) @@ -65,7 +65,7 @@ namespace Unity_Studio } else return base.ReadInt16(); } - + public override int ReadInt32() { if (endian == EndianType.BigEndian) @@ -76,7 +76,7 @@ namespace Unity_Studio } else return base.ReadInt32(); } - + public override Int64 ReadInt64() { if (endian == EndianType.BigEndian) @@ -87,7 +87,7 @@ namespace Unity_Studio } else return base.ReadInt64(); } - + public override UInt16 ReadUInt16() { if (endian == EndianType.BigEndian) @@ -98,7 +98,7 @@ namespace Unity_Studio } else return base.ReadUInt16(); } - + public override UInt32 ReadUInt32() { if (endian == EndianType.BigEndian) @@ -120,7 +120,7 @@ namespace Unity_Studio } else return base.ReadUInt64(); } - + public override Single ReadSingle() { if (endian == EndianType.BigEndian) @@ -131,7 +131,7 @@ namespace Unity_Studio } else return base.ReadSingle(); } - + public override Double ReadDouble() { if (endian == EndianType.BigEndian) @@ -182,20 +182,14 @@ namespace Unity_Studio } else { return ""; } } - + public string ReadStringToNull() { - string result = ""; - char c; - for (int i = 0; i < base.BaseStream.Length; i++) - { - if ((c = (char)base.ReadByte()) == 0) - { - break; - } - result += c.ToString(); - } - return result; + var bytes = new List(); + byte b; + while ((b = ReadByte()) != 0) + bytes.Add(b); + return Encoding.UTF8.GetString(bytes.ToArray()); } } } diff --git a/Unity Studio/Unity Classes/Font.cs b/Unity Studio/Unity Classes/Font.cs index 1e6e772..cb6d954 100644 --- a/Unity Studio/Unity Classes/Font.cs +++ b/Unity Studio/Unity Classes/Font.cs @@ -27,107 +27,162 @@ namespace Unity_Studio if (readSwitch) { - int m_AsciiStartOffset = a_Stream.ReadInt32(); - - if (sourceFile.version[0] <= 3) + if ((sourceFile.version[0] == 5 && sourceFile.version[1] >= 5) || sourceFile.version[0] > 5) { - int m_FontCountX = a_Stream.ReadInt32(); - int m_FontCountY = a_Stream.ReadInt32(); - } - - float m_Kerning = a_Stream.ReadSingle(); - float m_LineSpacing = a_Stream.ReadSingle(); - - if (sourceFile.version[0] <= 3) - { - int m_PerCharacterKerning_size = a_Stream.ReadInt32(); - for (int i = 0; i < m_PerCharacterKerning_size; i++) + var m_LineSpacing = a_Stream.ReadSingle(); + var m_DefaultMaterial = sourceFile.ReadPPtr(); + var m_FontSize = a_Stream.ReadSingle(); + var m_Texture = sourceFile.ReadPPtr(); + int m_AsciiStartOffset = a_Stream.ReadInt32(); + var m_Tracking = a_Stream.ReadSingle(); + var m_CharacterSpacing = a_Stream.ReadInt32(); + var m_CharacterPadding = a_Stream.ReadInt32(); + var m_ConvertCase = a_Stream.ReadInt32(); + int m_CharacterRects_size = a_Stream.ReadInt32(); + for (int i = 0; i < m_CharacterRects_size; i++) { - int first = a_Stream.ReadInt32(); + int index = a_Stream.ReadInt32(); + //Rectf uv + float uvx = a_Stream.ReadSingle(); + float uvy = a_Stream.ReadSingle(); + float uvwidth = a_Stream.ReadSingle(); + float uvheight = a_Stream.ReadSingle(); + //Rectf vert + float vertx = a_Stream.ReadSingle(); + float verty = a_Stream.ReadSingle(); + float vertwidth = a_Stream.ReadSingle(); + float vertheight = a_Stream.ReadSingle(); + float width = a_Stream.ReadSingle(); + + if (sourceFile.version[0] >= 4) + { + bool flipped = a_Stream.ReadBoolean(); + a_Stream.Position += 3; + } + } + int m_KerningValues_size = a_Stream.ReadInt32(); + for (int i = 0; i < m_KerningValues_size; i++) + { + int pairfirst = a_Stream.ReadInt16(); + int pairsecond = a_Stream.ReadInt16(); float second = a_Stream.ReadSingle(); } + var m_PixelScale = a_Stream.ReadSingle(); + int m_FontData_size = a_Stream.ReadInt32(); + if (m_FontData_size > 0) + { + m_FontData = new byte[m_FontData_size]; + a_Stream.Read(m_FontData, 0, m_FontData_size); + + if (m_FontData[0] == 79 && m_FontData[1] == 84 && m_FontData[2] == 84 && m_FontData[3] == 79) + { preloadData.extension = ".otf"; } + else { preloadData.extension = ".ttf"; } + } } else { - int m_CharacterSpacing = a_Stream.ReadInt32(); - int m_CharacterPadding = a_Stream.ReadInt32(); - } + int m_AsciiStartOffset = a_Stream.ReadInt32(); - int m_ConvertCase = a_Stream.ReadInt32(); - PPtr m_DefaultMaterial = sourceFile.ReadPPtr(); + if (sourceFile.version[0] <= 3) + { + int m_FontCountX = a_Stream.ReadInt32(); + int m_FontCountY = a_Stream.ReadInt32(); + } - int m_CharacterRects_size = a_Stream.ReadInt32(); - for (int i = 0; i < m_CharacterRects_size; i++) - { - int index = a_Stream.ReadInt32(); - //Rectf uv - float uvx = a_Stream.ReadSingle(); - float uvy = a_Stream.ReadSingle(); - float uvwidth = a_Stream.ReadSingle(); - float uvheight = a_Stream.ReadSingle(); - //Rectf vert - float vertx = a_Stream.ReadSingle(); - float verty = a_Stream.ReadSingle(); - float vertwidth = a_Stream.ReadSingle(); - float vertheight = a_Stream.ReadSingle(); - float width = a_Stream.ReadSingle(); + float m_Kerning = a_Stream.ReadSingle(); + float m_LineSpacing = a_Stream.ReadSingle(); + + if (sourceFile.version[0] <= 3) + { + int m_PerCharacterKerning_size = a_Stream.ReadInt32(); + for (int i = 0; i < m_PerCharacterKerning_size; i++) + { + int first = a_Stream.ReadInt32(); + float second = a_Stream.ReadSingle(); + } + } + else + { + int m_CharacterSpacing = a_Stream.ReadInt32(); + int m_CharacterPadding = a_Stream.ReadInt32(); + } + + int m_ConvertCase = a_Stream.ReadInt32(); + PPtr m_DefaultMaterial = sourceFile.ReadPPtr(); + + int m_CharacterRects_size = a_Stream.ReadInt32(); + for (int i = 0; i < m_CharacterRects_size; i++) + { + int index = a_Stream.ReadInt32(); + //Rectf uv + float uvx = a_Stream.ReadSingle(); + float uvy = a_Stream.ReadSingle(); + float uvwidth = a_Stream.ReadSingle(); + float uvheight = a_Stream.ReadSingle(); + //Rectf vert + float vertx = a_Stream.ReadSingle(); + float verty = a_Stream.ReadSingle(); + float vertwidth = a_Stream.ReadSingle(); + float vertheight = a_Stream.ReadSingle(); + float width = a_Stream.ReadSingle(); + + if (sourceFile.version[0] >= 4) + { + bool flipped = a_Stream.ReadBoolean(); + a_Stream.Position += 3; + } + } + + PPtr m_Texture = sourceFile.ReadPPtr(); + + int m_KerningValues_size = a_Stream.ReadInt32(); + for (int i = 0; i < m_KerningValues_size; i++) + { + int pairfirst = a_Stream.ReadInt16(); + int pairsecond = a_Stream.ReadInt16(); + float second = a_Stream.ReadSingle(); + } + + if (sourceFile.version[0] <= 3) + { + bool m_GridFont = a_Stream.ReadBoolean(); + a_Stream.Position += 3; //4 byte alignment + } + else { float m_PixelScale = a_Stream.ReadSingle(); } + + int m_FontData_size = a_Stream.ReadInt32(); + if (m_FontData_size > 0) + { + m_FontData = new byte[m_FontData_size]; + a_Stream.Read(m_FontData, 0, m_FontData_size); + + if (m_FontData[0] == 79 && m_FontData[1] == 84 && m_FontData[2] == 84 && m_FontData[3] == 79) + { preloadData.extension = ".otf"; } + else { preloadData.extension = ".ttf"; } + + } + + float m_FontSize = a_Stream.ReadSingle();//problem here in minifootball + float m_Ascent = a_Stream.ReadSingle(); + uint m_DefaultStyle = a_Stream.ReadUInt32(); + + int m_FontNames = a_Stream.ReadInt32(); + for (int i = 0; i < m_FontNames; i++) + { + string m_FontName = a_Stream.ReadAlignedString(a_Stream.ReadInt32()); + } if (sourceFile.version[0] >= 4) { - bool flipped = a_Stream.ReadBoolean(); - a_Stream.Position += 3; + int m_FallbackFonts = a_Stream.ReadInt32(); + for (int i = 0; i < m_FallbackFonts; i++) + { + PPtr m_FallbackFont = sourceFile.ReadPPtr(); + } + + int m_FontRenderingMode = a_Stream.ReadInt32(); } } - - PPtr m_Texture = sourceFile.ReadPPtr(); - - int m_KerningValues_size = a_Stream.ReadInt32(); - for (int i = 0; i < m_KerningValues_size; i++) - { - int pairfirst = a_Stream.ReadInt16(); - int pairsecond = a_Stream.ReadInt16(); - float second = a_Stream.ReadSingle(); - } - - if (sourceFile.version[0] <= 3) - { - bool m_GridFont = a_Stream.ReadBoolean(); - a_Stream.Position += 3; //4 byte alignment - } - else { float m_PixelScale = a_Stream.ReadSingle(); } - - int m_FontData_size = a_Stream.ReadInt32(); - if (m_FontData_size > 0) - { - m_FontData = new byte[m_FontData_size]; - a_Stream.Read(m_FontData, 0, m_FontData_size); - - if (m_FontData[0] == 79 && m_FontData[1] == 84 && m_FontData[2] == 84 && m_FontData[3] == 79) - { preloadData.extension = ".otf"; } - else { preloadData.extension = ".ttf"; } - - } - - float m_FontSize = a_Stream.ReadSingle();//problem here in minifootball - float m_Ascent = a_Stream.ReadSingle(); - uint m_DefaultStyle = a_Stream.ReadUInt32(); - - int m_FontNames = a_Stream.ReadInt32(); - for (int i = 0; i < m_FontNames; i++) - { - string m_FontName = a_Stream.ReadAlignedString(a_Stream.ReadInt32()); - } - - if (sourceFile.version[0] >= 4) - { - int m_FallbackFonts = a_Stream.ReadInt32(); - for (int i = 0; i < m_FallbackFonts; i++) - { - PPtr m_FallbackFont = sourceFile.ReadPPtr(); - } - - int m_FontRenderingMode = a_Stream.ReadInt32(); - } } else { diff --git a/Unity Studio/Unity Classes/PlayerSettings.cs b/Unity Studio/Unity Classes/PlayerSettings.cs index 0f36e29..e77dadd 100644 --- a/Unity Studio/Unity Classes/PlayerSettings.cs +++ b/Unity Studio/Unity Classes/PlayerSettings.cs @@ -16,6 +16,15 @@ namespace Unity_Studio var a_Stream = preloadData.sourceFile.a_Stream; a_Stream.Position = preloadData.Offset; + + if ((sourceFile.version[0] == 5 && sourceFile.version[1] >= 5) || sourceFile.version[0] > 5)//5.5.0 nad up + { + //productGUID + a_Stream.ReadInt32(); + a_Stream.ReadInt32(); + a_Stream.ReadInt32(); + a_Stream.ReadInt32(); + } if (sourceFile.version[0] >= 3) { if (sourceFile.version[0] == 3 && sourceFile.version[1] < 2) { string AndroidLicensePublicKey = a_Stream.ReadAlignedString(a_Stream.ReadInt32()); } diff --git a/Unity Studio/Unity Classes/Shader.cs b/Unity Studio/Unity Classes/Shader.cs new file mode 100644 index 0000000..d7f2691 --- /dev/null +++ b/Unity Studio/Unity Classes/Shader.cs @@ -0,0 +1,74 @@ +using System.Text; + +namespace Unity_Studio +{ + class Shader + { + public string m_Name; + public byte[] m_Script; + public string m_PathName; + + public Shader(AssetPreloadData preloadData, bool readSwitch) + { + var sourceFile = preloadData.sourceFile; + var a_Stream = preloadData.sourceFile.a_Stream; + a_Stream.Position = preloadData.Offset; + preloadData.extension = ".txt"; + + if (sourceFile.platform == -2) + { + uint m_ObjectHideFlags = a_Stream.ReadUInt32(); + PPtr m_PrefabParentObject = sourceFile.ReadPPtr(); + PPtr m_PrefabInternal = sourceFile.ReadPPtr(); + } + + m_Name = a_Stream.ReadAlignedString(a_Stream.ReadInt32()); + if ((sourceFile.version[0] == 5 && sourceFile.version[1] >= 5) || sourceFile.version[0] > 5) + { + if (readSwitch) + { + m_Script = Encoding.UTF8.GetBytes("Serialized Shader can't be read"); + } + else + { + if (m_Name != "") { preloadData.Text = m_Name; } + else { preloadData.Text = preloadData.TypeString + " #" + preloadData.uniqueID; } + preloadData.SubItems.AddRange(new string[] { preloadData.TypeString, preloadData.exportSize.ToString() }); + + } + } + else + { + int m_Script_size = a_Stream.ReadInt32(); + + if (readSwitch) //asset is read for preview or export + { + m_Script = new byte[m_Script_size]; + a_Stream.Read(m_Script, 0, m_Script_size); + + if (m_Script[0] == 93) { m_Script = SevenZip.Compression.LZMA.SevenZipHelper.Decompress(m_Script); } + if (m_Script[0] == 60 || (m_Script[0] == 239 && m_Script[1] == 187 && m_Script[2] == 191 && m_Script[3] == 60)) { preloadData.extension = ".xml"; } + } + else + { + byte lzmaTest = a_Stream.ReadByte(); + if (lzmaTest == 93) + { + a_Stream.Position += 4; + preloadData.exportSize = a_Stream.ReadInt32(); //actualy int64 + a_Stream.Position -= 8; + } + else { preloadData.exportSize = m_Script_size; } + + a_Stream.Position += m_Script_size - 1; + + if (m_Name != "") { preloadData.Text = m_Name; } + else { preloadData.Text = preloadData.TypeString + " #" + preloadData.uniqueID; } + preloadData.SubItems.AddRange(new string[] { preloadData.TypeString, preloadData.exportSize.ToString() }); + } + a_Stream.AlignStream(4); + m_PathName = a_Stream.ReadAlignedString(a_Stream.ReadInt32()); + } + } + } +} diff --git a/Unity Studio/Unity Classes/SkinnedMeshRenderer.cs b/Unity Studio/Unity Classes/SkinnedMeshRenderer.cs index 2309f81..9521117 100644 --- a/Unity Studio/Unity Classes/SkinnedMeshRenderer.cs +++ b/Unity Studio/Unity Classes/SkinnedMeshRenderer.cs @@ -60,14 +60,29 @@ namespace Unity_Studio m_Materials[m] = sourceFile.ReadPPtr(); } - if (version[0] < 3) { a_Stream.Position += 16; } //m_LightmapTilingOffset vector4d + if (version[0] < 3) + { + a_Stream.Position += 16;//m_LightmapTilingOffset vector4d + } else { - int m_SubsetIndices_size = a_Stream.ReadInt32(); - a_Stream.Position += m_SubsetIndices_size * 4; + if ((sourceFile.version[0] == 5 && sourceFile.version[1] >= 5) || sourceFile.version[0] > 5)//5.5.0 and up + { + a_Stream.Position += 4;//m_StaticBatchInfo + } + else + { + int m_SubsetIndices_size = a_Stream.ReadInt32(); + a_Stream.Position += m_SubsetIndices_size * 4; + } PPtr m_StaticBatchRoot = sourceFile.ReadPPtr(); - if (version[0] >= 4 || (version[0] == 3 && version[1] >= 5)) + if ((sourceFile.version[0] == 5 && sourceFile.version[1] >= 4) || sourceFile.version[0] > 5)//5.4.0 and up + { + PPtr m_ProbeAnchor = sourceFile.ReadPPtr(); + PPtr m_LightProbeVolumeOverride = sourceFile.ReadPPtr(); + } + else if (version[0] >= 4 || (version[0] == 3 && version[1] >= 5)) { bool m_UseLightProbes = a_Stream.ReadBoolean(); a_Stream.Position += 3; //alignment @@ -80,7 +95,7 @@ namespace Unity_Studio { if (version[0] == 4 && version[1] <= 3) { int m_SortingLayer = a_Stream.ReadInt16(); } else { int m_SortingLayer = a_Stream.ReadInt32(); } - + int m_SortingOrder = a_Stream.ReadInt16(); a_Stream.AlignStream(4); } diff --git a/Unity Studio/Unity Classes/Texture2D.cs b/Unity Studio/Unity Classes/Texture2D.cs index bad3490..a9417b2 100644 --- a/Unity Studio/Unity Classes/Texture2D.cs +++ b/Unity Studio/Unity Classes/Texture2D.cs @@ -442,8 +442,8 @@ namespace Unity_Studio } case TextureFormat.ATC_RGBA8: //透明通道很奇怪? { - q_format = (int)QFORMAT.Q_FORMAT_ATC_RGBA_EXPLICIT_ALPHA; - glInternalFormat = KTXHeader.GL_ATC_RGBA_EXPLICIT_ALPHA_AMD; + q_format = (int)QFORMAT.Q_FORMAT_ATC_RGBA_INTERPOLATED_ALPHA; + glInternalFormat = KTXHeader.GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD; glBaseInternalFormat = KTXHeader.GL_RGBA; break; } diff --git a/Unity Studio/Unity Studio.csproj b/Unity Studio/Unity Studio.csproj index 237ae67..b4dcadf 100644 --- a/Unity Studio/Unity Studio.csproj +++ b/Unity Studio/Unity Studio.csproj @@ -174,6 +174,7 @@ + diff --git a/Unity Studio/UnityStudioForm.cs b/Unity Studio/UnityStudioForm.cs index 9db225b..692a7d2 100644 --- a/Unity Studio/UnityStudioForm.cs +++ b/Unity Studio/UnityStudioForm.cs @@ -700,6 +700,11 @@ namespace Unity_Studio break; } case 48: //Shader + { + Shader m_TextAsset = new Shader(asset, false); + exportable = true; + break; + } case 49: //TextAsset { TextAsset m_TextAsset = new TextAsset(asset, false); @@ -1286,13 +1291,23 @@ namespace Unity_Studio break; } #endregion - #region Shader & TextAsset + #region Shader case 48: + { + Shader m_TextAsset = new Shader(asset, true); + string m_Script_Text = Encoding.UTF8.GetString(m_TextAsset.m_Script); + m_Script_Text = Regex.Replace(m_Script_Text, "(?