- Home /
 
How to access color & texture functions of a "RawImage Script" simontaneously??
I want my rawimage to randomly access color and texture of different multiple rawimages . I have successfully done that but the problem is that i want it to access both color & texture of same rawimage . But i seem to access color and texture of 2 different raw images due to which my main raw image is mixture of color and texture of 2 different images rather than one.
 using UnityEngine;
 using System.Collections;
 using UnityEngine.UI;
 
 public class DisplayColor7 : MonoBehaviour {
 
 
     public RawImage[] buttons;
 
     public    void Start () {
         
         
         changeColor ();
         
         
     }
     
     
     public    void changeColor() {
 
         GetComponent<RawImage> ().texture = buttons [Random.Range (0, buttons.Length - 1)].texture;
         GetComponent<RawImage> ().color = buttons [Random.Range (0, buttons.Length - 1)].color;
 
     }
 }
 
              
               Comment
              
 
               
              Your answer