Quantcast
Channel: Latest Questions on Unity Answers
Viewing all articles
Browse latest Browse all 171066

How to Deserialize an XML textasset?

$
0
0
So I have this code: var serializer = new XmlSerializer(typeof(MyClass)); using(var stream = new FileStream(path, FileMode.Open)) { return serializer.Deserialize(stream) as MyClass; } Basically, it reads an xml file from "path" and returns it as a MyClass. But what if instead of having the file's path, I have a public TextAsset variable referencing the actual file? How could I deserialize the "textasset" xml file into MyClass?

Viewing all articles
Browse latest Browse all 171066


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>