Re enable the script to recover the initial variables

My Flow:

(go1.GetComponent (typeof(phase1)) as phase1).enabled = true;

(go1.GetComponent (typeof(phase1)) as phase1).enabled = false;

(go1.GetComponent (typeof(phase1)) as phase1).enabled = true;

I could not able to recover the transy intial value on re-enabling


using UnityEngine;
using System.Collections;

public class phase1 : MonoBehaviour {

// Use this for initialization
public Texture2D struc,activit;
public string next1, next2;
private float transy=(int)(Screen.height*1.2f),transend=(int)((float)Screen.height/1.4);
void Start () {
	transy = (int)(Screen.height * 1.2f);


// Update is called once per frame

void OnGUI(){
	Debug.Log ("I am active");
	//GUI.color = Color.clear;	
	if (transy > transend) {


What I want is:
void Reinitialize(){
//initalize all variables again
Is there any method like this which provides for re-initializing variables

There is no reason you can’t wrap your initialisation method and call it as often as you like.

void Start (){

void myCustomStart(){
    // Run all your initialisation here

void OnEnable (){

// Inside any other method that makes sense

from the docs:

“Start is called on the frame when a script is enabled just before any of the Update methods is called the first time.”