public void OnDrawGizmosSelected() { Transform t = transform.parent; if (t == null) { return; } SplineComponent splineComponent = t.gameObject.GetComponent <SplineComponent>(); if (splineComponent == null) { return; } splineComponent.OnDrawGizmosSelected(); Gizmos.color = splineComponent.controlPointColorSelected; Gizmos.DrawSphere(transform.position, splineComponent.sphereRadius * 1.2f); if (!position.Equals(oldPos)) { oldPos = position; splineComponent.UpdateSpline(); } }