Their tried a compressed images show and then again after failed
Now to post a code
Void the Start () {
StartCoroutine (" LoadImage ", "D: \ \ 345 JPG");
}
Void OnGUI ()
{
If (texture!=null)
{
GUI. DrawTexture (new the Rect (100, 100, 1000, 1000), texture);
}
}
Private IEnumerator LoadImage (string imagePath)
{
WWW WWW=new WWW (" file:///imagePath + ");
The Debug Log (imagePath);
If (==null www.error
{
}
The else
{
The Debug. LogError (" LoadImage>> www.error: + www.error ");
}
Yield return WWW.
Texture=www.texture;
}
Image information
The unity of the show effect
CodePudding user response:
Initialization texture has a problem?CodePudding user response:
Look at the code, it is no problemThen don't load the picture of more than 2 m...
CodePudding user response:
That is because the default maxTextureSize unity WWW loaded texture is 2048, your image size super, need to modify as follows:Var texture=new Texture2D (www.texture.width, www.texture.height);//create a specified size texture
Texture. LoadImage (www.bytes); Load the texture data line
I hope to adopt