Unity Networking Quiz (WWW)

Source: Internet
Author: User

Study a lot of ways of networking, even the tcp/ip,shock,http of the relationship is clear, and finally figure out how to use GET or post in unity to communicate, or a little excited, but do not rule out a better way, heard unity can write their own shock. I have not done any research here, it is to use Unity's own WWW class to achieve.

This is a relatively simple way, just pass the URL, there are many ways to further data transmission, and so on.

I packed a CS .... Available for use, with the Momo learning ...

usingUnityengine;usingSystem.Collections; Public classWebTest {#regionSingle-Instance classPrivate StaticWebTest minstance =NewWebTest ();  Public StaticWebTest Instance {Get{returnminstance;} }    #endregion    /// <summary>    ///Send Read Message/// </summary>    /// <param name= "url" >the URL to access</param>    /// <returns>wait for return data</returns>     PublicIEnumerator Resmessage (stringURL) {WWW www_instance=NewWWW (URL); yield returnwww_instance; if(Www_instance.text = =NULL) {Debug.logerror ("NULL!"); }        Else{Debug.Log (www_instance.text); }    }}

Unity Networking Quiz (WWW)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.