public void Generate() { if (training == null) { Debug.Log("Can't Generate: no designated Training component"); } if (IsPrefabRef(training.gameObject)) { GameObject o = CreatePrefab(training.gameObject, new Vector3(0, 99999f, 0f), Quaternion.identity); training = o.GetComponent <Training>(); } if (training.sample == null) { training.Compile(); } if (output == null) { Transform ot = transform.Find("output-overlap"); if (ot != null) { output = ot.gameObject; } } if (output == null) { output = new GameObject("output-overlap"); output.transform.parent = transform; output.transform.position = this.gameObject.transform.position; output.transform.rotation = this.gameObject.transform.rotation; } for (int i = 0; i < output.transform.childCount; i++) { GameObject go = output.transform.GetChild(i).gameObject; if (Application.isPlaying) { Destroy(go); } else { DestroyImmediate(go); } } group = new GameObject(training.gameObject.name).transform; group.parent = output.transform; group.position = output.transform.position; group.rotation = output.transform.rotation; group.localScale = new Vector3(1f, 1f, 1f); rendering = new GameObject[width, depth]; model = new OverlappingModel(training.sample, N, width, depth, periodicInput, periodicOutput, symmetry, foundation, xloc, zloc); undrawn = true; Run(); }
public override void OnInspectorGUI() { Training training = (Training)target; if (GUILayout.Button("compile")) { training.Compile(); } if (GUILayout.Button("record neighbors")) { training.RecordNeighbors(); } DrawDefaultInspector(); }