how to load external images for sphere texture unity

1.8k Views Asked by At

i'm trying to create a unity script that will generate a 360° visit and it must be managed by a web platform (where you upload your 360° images ) so my sphere in the unity script must load external images for the sphere texture. I found only how to load external images for texture2D. Help please I tried this script script to load image and this is how it look how it looks

2

There are 2 best solutions below

0
On

it's solved now i can load external images from url to set in my sphere texture . this is the script new script and now this is how it looks

0
On

The first step is correct with loading the image in to a Texture2D however you now need to assign that texture to the spheres material. There are someways to do that and one of them is this

//Assuming sphere is a reference to a GameObject with a renderer attached
//After loading image
sphere.GetComponent<Renderer>().material.mainTexture = img;

This should replace the materials main texture with the image you loaded.