纳金网

标题: 用C#下载图片 [打印本页]

作者: 王者再临    时间: 2015-2-26 23:53
标题: 用C#下载图片

用C#下载图片
  1. using UnityEngine;

  2. using System.Collections;

  3. public class NewBehaviourScript : MonoBehaviour {

  4. public GameObject obj;

  5. // Use this for initialization

  6. WWW www;

  7. void Start () {

  8. StartCoroutine(ABC(“[img]http://images.earthcam.com/ec_metros/ourcams/fridays.jpg[/img]”));

  9. }

  10. // Update is called once per frame

  11. void Update ()

  12. {

  13. if(www.isDone)

  14. {

  15. renderer.material.mainTexture = www.texture;

  16. www=null;

  17. }

  18. else

  19. {

  20. print(www);

  21. }

  22. }

  23. public IEnumerator ABC(string URL)

  24. {

  25. www = new WWW (URL);

  26. yield return www;

  27. }

  28. }
复制代码





欢迎光临 纳金网 (http://go.narkii.com/club/) Powered by Discuz! X2.5