0

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

halfer
  • 19,824
  • 17
  • 99
  • 186
  • 1
    That sounds pretty close to your goal...load your image into a Texture2D, use that Texture2D on a material, apply that material to a sphere...success? Have you made any attempts that demonstrate how this approach might not be viable? – Serlite Feb 12 '17 at 05:45
  • you can check my script to load image – Oussama Ayed Feb 12 '17 at 14:44
  • For your question code and your answer code, would you post them as text? We discourage code pasted as images, since that does not work with clipboards, screen-readers or search engines. – halfer Feb 12 '17 at 20:33

2 Answers2

1

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

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.

Johan Lindkvist
  • 1,734
  • 15
  • 24