- Home /
useing WWW Class
I'm reading the images and sounds in terms of their WWW class, but I'm having problems when something does not work as expected.
Source is such a feeling.
WWW www = new WWW (url); yield return www;
//Texture Texture[num] = www.texture;
//Sound audioClip[num] = www.audioClip; audioSource.volume = 1.0f; audioSource.clip = audioClip[num];
Please point out if there is a mistake.
Answer by Kiloblargh · Mar 03, 2014 at 04:40 AM
www.texture should be type Texture2D. I do not know why there is a difference between Texture and Texture2D but there is.
You should never name an array of AudioClips "`audioClip[]`" and you should never name an array of textures "`Texture[]`". Come up with original non-reserved names, and make sure you dimension the array before assigning to it and that
num
is less than its Length.You need to get 2 different URLs and 2 different WWW calls for the audioClip and the texture. You can't use the same file for a sound and an image.
Your answer
![](https://koobas.hobune.stream/wayback/20220613135230im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to assign texture from url 1 Answer
Distribute terrain in zones 3 Answers
Load an image from www and save it for offline use 0 Answers
Multiple Cars not working 1 Answer
cant get Texture2D.LoadImage() to work 0 Answers