I cant call function another script !

Hi guys , i have bool (isFire,isWater…) and i cannot call the inside the ConfirmButton function boolean variables in the ArenaBackground class. Boolean variables seems false all the time.

Could you help me ?

using UnityEngine;
using System.Collections;
using UnityEngine.SceneManagement;

namespace S3{
public class CharacterSelection : MonoBehaviour {

	private GameObject[] characterList;
	private int index;
		//Character 
	public bool isFire;
	public bool isWater;
	public bool isEarth;
	public bool isWood;


	private void Start(){


			index = PlayerPrefs.GetInt ("CharacterSelected");

			characterList = new GameObject[transform.childCount];


			foreach (Transform t in transform) {
				
				//fill the array our models
				for (int i = 0; i < transform.childCount; i++) {

					characterList  *= transform.GetChild (i).gameObject;*
  •  		}*
    
  •  		//we toggle of their renderer*
    
  •  		foreach (GameObject go in characterList) {*
    
  •  			go.SetActive (false);*
    
  •  		}*
    
  •  		//toggle on the selected character*
    
  •  		if (characterList [index])*
    
  •  			characterList [index].SetActive (true);*
    
  •  	}*
    
  • } //Start function end*

  •  public void ToggleBack(){*
    
  •  	SceneManager.LoadScene ("GTGD S3");*
    
  •  }*
    
  •  public void ToggleLeft(){*
    
  •  	characterList [index].SetActive (false);*
    
  •  	index--;*
    
  •  	if (index < 0) {*
    
  •  		index = characterList.Length - 1;*
    
  •  	}*
    
  •  	characterList [index].SetActive (true);*
    
  •  } // Toggle Left End*
    
  •  public void ToggleRight(){*
    
  •  	characterList [index].SetActive (false);*
    
  •  	index++;*
    
  •  	if (index == characterList.Length) {*
    
  •  		index =0;*
    
  •  	}*
    
  •  	characterList [index].SetActive (true);*
    
  •  }*
    
  •  public  void  ConfirmButton(){*
    
  •  	PlayerPrefs.SetInt ("CharacterSelected", index);*
    
  •  	SceneManager.LoadScene ("LevelTry");*
    
  •  		if (index == 0) {*
    
  •  	  	isFire = true;*
    
  •  		Debug.LogFormat ("Fire");*
    
  •  	} else if (index == 1) {*
    
  •  			isWater = true;*
    
  •  			Debug.LogFormat ("Water");*
    
  •  		} else if (index == 2) {*
    
  •  		isEarth = true;*
    
  •  			Debug.LogFormat ("Earth");*
    
  •  		} else if (index == 3) {*
    
  •  		isWood = true;*
    
  •  		Debug.LogFormat ("Wood");*
    
  •  	}*
    
  •  }*
    

}
}
And , my secondary script
using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;

namespace S3{

  • public class ArenaBackground : MonoBehaviour {*

  •  public  CharacterSelection arenaBG;*
    
  • // Use this for initialization*

  • void Start () {*

  •  arenaBG = gameObject.AddComponent<CharacterSelection>();*
    
  •  	if (arenaBG.isFire) {*
    
  •  		Debug.LogFormat ("Yes !");*
    
  •  	}*
    
  •  	else{*
    
  •  			Debug.LogFormat("No !");*
    
  •  	}*
    
  •  }* 
    

}
}

If you call ConfirmButton() isFire would be set to true by default and the rest to false. Since it is a public method and you add CharacterSelection while storing a reference in ArenaBackground you should be able to call the method.