public void CreateBounce(GameObject origin, GameObject target) { GameObject bounce = new GameObject("SCSpell_LightningBounce"); SC_LightningBounce lightningBounce = bounce.AddComponent <SC_LightningBounce>(); lightningBounce.SetOrigin(origin); lightningBounce.SetTarget(target); lightningBounce.SetBounceRadius(bounceRadius); lightningBounce.SetTimeBetweenBounces(timeBetweenBounces); lightningBounce.SetParent(gameObject); lightningBounce.Init(lightningStrength, lineRendererPrefab, lightRendererPrefab, startColour, endColour); Destroy(bounce, 2.0f); StartCoroutine(CheckForNextBounce(lightningBounce)); }