public List<AttribData> ParseFunc(StringBuilder sb) { List<AttribData> attrib_data = new List<AttribData>(); String[] items = sb.ToString().Split('\n'); for (int i = 0; i < items.Length; i++) { String[] values = items[i].Split(' '); for (int j = 0; j < values.Length; j++) { try { AttribData ad = new AttribData(); if (eGLTypeDrawVertex == VertexAttribPointerType.Float) { switch (eGLTypeDrawVertex) { case VertexAttribPointerType.Float: ad.fValue = float.Parse(values[j]); break; default: throw new Exception("Unidentified type"); } } else { switch (eGLTypeDrawElement) { case DrawElementsType.UnsignedInt: ad.uiValue = UInt32.Parse(values[j]); break; case DrawElementsType.UnsignedShort: ad.usValue = UInt16.Parse(values[j]); break; case DrawElementsType.UnsignedByte: ad.ubValue = byte.Parse(values[j]); break; default: throw new Exception("Unidentified type"); } } attrib_data.Add(ad); } catch { // No error here skip white space in files MessageBox.Show("Error " + ex.ToString()); } } } return attrib_data; }
public AttribData LoadLazy() { if (attribData == null) { #if UNITY_WEBGL var data = Resources.Load <TextAsset>("TweakMe"); var jsonData = JsonUtility.FromJson <JsonData>(data.text); #else var path = Application.dataPath + "/Resources/TweakMe.json"; var data = System.IO.File.ReadAllText(path); var jsonData = JsonUtility.FromJson <JsonData>(data); #endif attribData = jsonData.ToAttribData(); } return(attribData); }