Unity用WWW加载图片

 //将脚本挂在一个物体上就行

using System.Collections;
using System.Collections.Generic;
using UnityEngine;


public class UseWWW : MonoBehaviour {

    // Use this for initialization
    public string path = "http://uploads.5068.com/allimg/1801/16493T5W-4.jpg";
    IEnumerator Start () {
        WWW www = new WWW(path);
        yield return www;
        Renderer render = GetComponent<Renderer>();
        render.material.mainTexture = www.texture;
    }
	
	// Update is called once per frame
	void Update () {
		
	}
}


版权声明:本文为piyixia原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。