private void GenerateTransmitter() { generation = gameObject.AddComponent <TransmitterGeneration>(); pieces = generation.Generate(connections, transmitter, nonTransmitter, transform).ToArray(); for (int i = 0; i < pieces.Length; i++) { if (pieces[i].transform.childCount > 0) { pieces[i].transform.GetChild(0).gameObject.SetActive(false); } } if (startPoint) { Spark spark = Instantiate(sparkPrefab, transform.position, Quaternion.identity).GetComponent <Spark>(); spark.GiveTransmitter(this); } if (endPoint) { // Spawn the end point thing here if (endPointPrefab != null) { Instantiate(endPointPrefab, transform.position, endPointParticle.transform.rotation); } if (endPointParticle != null) { Instantiate(endPointParticle, transform.position, endPointParticle.transform.rotation); } } }