- Home /
How to change the alpha of a sprite
I have a script and I want it so that when I cant press a button the the alpha changes to half. my script is:
 using UnityEngine;
 using System.Collections;
 
 public class Play : MonoBehaviour {
 
     public static bool readyToGo;
     public SpriteRenderer me;
 
     void OnMouseDown(){
         if (readyToGo) {
             if (SelectMode.modeSelect == 0) {
                 Application.LoadLevel ("Original");        
             }
             if (SelectMode.modeSelect == 1) {
                 Application.LoadLevel ("Ascension");        
             }
             if (SelectMode.modeSelect == 2) {
                 Application.LoadLevel ("Freefall");        
             }
         }
     }
 
     void Update(){
         if (!readyToGo) {
             //me.sprite.a = 0.5f;        
         }
     }
 }
Does anybody know how to achieve this?
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Itaros · Oct 26, 2014 at 05:03 PM
In the class:
private Color c = new Color(1F,1F,1F,0.5F);
Where you need to set its alpha:
me.color = c;
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                