In a Quiz game, depending on the answer ( if Input.GetKeyDown…), I want to apply a texture to an object and to play a sound.
Problem is this minute function does not display the texture AND play the sound (the object is displayed completely white and the sound is played). Why?
void the_event (int the_input) {
obj = GameObject.Find ("Rectangle");
obj.renderer.material.mainTexture = Resources.Load (matrix [the_input, 2]) as Texture;
sound = matrix [the_input, y];
audio.clip = Resources.Load (sound) as AudioClip;
audio.Play ();
}
Based on what lines I disable, the function correctly applies the texture OR plays the sound.
The white “texture” might signify a null return from that Ressources.Load.
I don’t understand what the problem is.
Should I break the response into separate frames? Frame 1 - texture, frame 2 - sound?
Should I do a LoadAll in Start() ? Not sure how I would address what I need then…
Heeeelp