Game Development Reference
In-Depth Information
Text Assets - loading from the Web
If you're making multiplayer games and need to access player or game data across
the Web, if you need to verify passwords with hashes online, or if you need to access
a web page to process its elements, then you will need the WWW class to retrieve text
data online, as shown in the following code sample 6-32:
//Gets text from the web in a string
public IEnumerator GetTextFromURL(string URL)
{
//Create new WWW object
WWW TXTSource = new WWW(URL);
//Wait for data to load
yield return TXTSource;
//Now get text data
string ReturnedText = TXTSource.text;
}
More information on the WWW class can be found in the online Unity
documentation at http://docs.unity3d.com/ScriptReference/
WWW.html .
Summary
This chapter considered a wide range of applications for the Mono Framework in
practical contexts. It took a three-part structure. First, we explored common data
structures used in C#, including List , Dictionary , and Stack . From there, we moved
on to investigate their common usages in storing and searching data and in organizing
and processing strings. We also explored regular expressions for searching strings
for patterns of data and the Linq language for filtering not only strings but all the
collection-type objects available in Mono. Then, finally, we examined various methods
to import text data, both internally to the project and from local files, as well as text
data streamed across the Web. The next chapter moves into the world of artificial
intelligence; it considers path-finding, finite state machines, line of sight, decision
making, ray casting, and more.
 
Search WWH ::




Custom Search