public static FBXFile ParseFile(string path) { FBXFile file = new FBXFile(); try { using (StreamReader sr = new StreamReader(path)) { while (!sr.EndOfStream) { string line = sr.ReadLine(); //Skip comments and empty lines if (line.Length == 0 || isComment(line)) { continue; } //detect node start if (line.Contains(":")) { file.nodes.Add(new_node(sr, line)); } } } } catch (Exception e) { Debug.LogError("The file could not be read:"); Debug.LogError(e.Message); Debug.LogError(e.StackTrace); } file.Name = Path.GetFileNameWithoutExtension(path); return(file); }
void OnEnable() { path = Application.dataPath + "/" + path + ".fbx"; fbx = ParseFile(path); }