This post has been wikified, any user with enough reputation can edit it. 
            
 
             
               Question by 
               Choppa · Feb 08, 2016 at 01:21 PM · 
                texturesavetoggletoggle buttonstate saving  
              
 
              Toggle Group save stats
Hello there, I have toggle group and 3 toggles inside to change cars color and i wanna know how to save selected toggle button to match cars color selected when i leave scene or quit game. Thank you!
Code i use to change texture
 using UnityEngine;
 
 public class Color1Test: MonoBehaviour {
 
     public Renderer rend;
     public Texture[] textures;
 
     void Start()
     {
         rend = GetComponent<Renderer>();
         rend.material.mainTexture = textures[PlayerPrefs.GetInt("SaveColor1", 0)];
     }
 
     public void Red()
     {
         rend.material.mainTexture = textures[0];
         PlayerPrefs.SetInt("SaveColor1", 0);
     }
 
     public void Blue()
     {
         rend.material.mainTexture = textures[1];
         PlayerPrefs.SetInt("SaveColor1", 1);
     }
 
     public void Green()
     {
         rend.material.mainTexture = textures[2];
         PlayerPrefs.SetInt("SaveColor1", 2);
     }
 }
               Comment
              
 
               
              Basically to have on Start last active toggle in group active (selected).
Your answer
 
 
              koobas.hobune.stream
koobas.hobune.stream 
                       
                
                       
			     
			 
                