//Working public void ConnectToParentNonRec(GameObject otherElement) { CircuitElement parent = gameObject.GetComponentInParent <CircuitElement> (); if (parent != null) { if (LeftEdge) { parent.ConnectToLeft(otherElement); } else { parent.ConnectToRight(otherElement); } Snap(otherElement.transform.position); edgeCollider.enabled = false; } else { Debug.LogWarning("Found an edge circle without parent<CircuitElement>"); } }
//Working public void ConnectToParent(GameObject otherElement) { CircuitElement parent = gameObject.GetComponentInParent <CircuitElement> (); if (parent != null) { if (LeftEdge) { parent.ConnectToLeft(otherElement); } else { parent.ConnectToRight(otherElement); } otherElement.GetComponent <EdgeHandler>().ConnectToParentNonRec(gameObject); edgeGFX.color = Color.red; edgeCollider.enabled = false; } else { Debug.LogWarning("Found an edge circle without parent<CircuitElement>"); } }