void OnDrawGizmos() { _instance = this; Gizmos.color = Color.black; List <Transform> allPoints = new List <Transform>(); foreach (Rigidbody attractor in Attractors) { if (attractor.transform.childCount > 0) { var blowScript = attractor.GetComponent <OnUpdaterBlow>(); if (blowScript != null && blowScript.blowed) { var listOfRigChild = attractor.GetComponentsInChildren <Rigidbody>(); foreach (var item in listOfRigChild) { allPoints.Add(item.transform); // Gizmos.DrawLine( _instance.mainSphere.position , item.position); } } } allPoints.Add(attractor.transform); // Gizmos.DrawLine( _instance.mainSphere.position , attractor.position); } for (int i = 0; i < allPoints.Count; i++) { Gizmos.DrawLine(_instance.mainSphere.position, allPoints[i].position); } // Debug.Log("draw"); }
void Awake() { _instance = this; }