public void ClearSteps() { currPartIdx = 0; while (currPartIdx < transform.childCount) { Transform currPart = transform.GetChild(currPartIdx++); Step nestedStep = currPart.GetComponent <Step>(); if (nestedStep != null) { continue; } SubModel nestedSubModel = currPart.GetComponent <SubModel>(); if (nestedSubModel != null) { nestedSubModel.ClearSteps(); continue; } currPart.gameObject.SetActive(false); } currPartIdx = 0; }
// Update is called once per frame void Update() { if (Input.GetKeyDown(KeyCode.C)) { rootModel.ClearSteps(); ready = true; } if (ready && Input.GetKeyDown(KeyCode.F)) { rootModel.NextStep(); } if (ready && Input.GetKeyDown(KeyCode.R)) { rootModel.PreviousStep(); } }