void Update() { if (transform.parent.GetComponent <MindMap>().mode == DemonstrationMode.Volume && mode == DemonstrationMode.Flat) { Destroy(model); SetupVolumeNode(); // enable caption as we will show text on the shape transform.GetChild(0).gameObject.SetActive(true); mode = DemonstrationMode.Volume; } else if (transform.parent.GetComponent <MindMap>().mode == DemonstrationMode.Flat && mode == DemonstrationMode.Volume) { // disable caption as we will show text on the shape transform.GetChild(0).gameObject.SetActive(false); Destroy(model); SetupFlatNode(); mode = DemonstrationMode.Flat; } // applying changing of the size if it happens if (prevSize != size) { gameObject.transform.localScale = Vector3.one * size; prevSize = size; } }
void Start() { while (!GameObject.FindObjectOfType <MindMap>()) { mode = GameObject.FindObjectOfType <MindMap>().GetComponent <Node>().mode; } if (mode == DemonstrationMode.Volume) { // enable caption as we will show text on the shape transform.GetChild(0).gameObject.SetActive(true); SetupVolumeNode(); } else if (mode == DemonstrationMode.Flat) { // disable caption as we will show text on the shape transform.GetChild(0).gameObject.SetActive(false); SetupFlatNode(); } // the size is not changing at the start prevSize = size; }