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
phase1.cs
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) {
transy-=4;
}
}
}
What I want is:
void Reinitialize(){
//initalize all variables again
}
Is there any method like this which provides for re-initializing variables