assign value for all the script

how can i do that when i set a value for a variable, for example i have this script:

using UnityEngine;
using System.Collections;

public class Cards : MonoBehaviour {
	bool start = false;
	string cardName;
	// Use this for initialization
	void Start () {
	// Update is called once per frame
	void Update () {

	void OnMouseOver() { 
			transform.rotation = Quaternion.AngleAxis(30,Vector3.up);
			start = true;
			cardName = gameObject.tag;			

and i want the “cardName” variable’s value to get stored even after the if clause have finished, so i could use the variable with the value “gameObject.tag” (it will change after in my program).

Not really sure what you are asking, but you could store the value in the Start function

   void Start(){

How is this NOT working? Are you getting an error? What are you trying to accomplish? There is no point in storing gameObject.tag because it will not change. If you want to have a global variable that stores the current selected card, put ‘static’ in front of ‘var’ but really, it should be a different arrangement of things: a ‘card manager’ which keeps track of all cards, and a ‘card select’ script which manages the ‘click’