void Start()
    {
        if (Spline == null)
        {

           GameObject obj=  new GameObject("path");
            obj.transform.position = transform.position;
            Spline = obj.AddComponent<SplineObject>();

            Spline.AddNode(transform.position);

            Vector3 mid = (target.position - transform.position)/2+transform.position;
          //  float angle = Mathf.Acos(Vector3.Dot(transform.position.normalized, target.position.normalized)) * Mathf.Rad2Deg;
            var len = (target.position - transform.position).magnitude;

          Vector3 ddd = Quaternion.Euler(0, 0, 90) * (target.position - mid).normalized * Mathf.Clamp(len / 2f, 1, 5);

            Spline.AddNode(mid + ddd);
            Spline.AddNode(target.position);
        }

           var tp=	this.TweenPath( Spline.Spline )
            .SetDuration( Duration )
            .SetEasing( TweenEasingFunctions.GetFunction( Easing ) )
            .SetLoopType( Loop )
            .SetTimeScaleIndependent( true )
            .Play();
        tp.OnCompleted(onTweenComplete);
    }
		private void ensureNodeComponents( SplineObject component )
		{

			var count = component.transform.childCount;
			for( int i = 0; i < count; i++ )
			{

				var point = component.transform.GetChild( i ).gameObject;
				if( point.GetComponent<SplineNode>() == null )
				{
					point.AddComponent<SplineNode>();
				}

			}

		}
		public override void OnInspectorGUI()
		{

			if( Application.isPlaying )
				return;

			if( serializedObject.isEditingMultipleObjects )
				return;

			this.node = target as SplineNode;
			if( node.transform.parent == null )
				return;

			this.spline = node.transform.parent.GetComponent<SplineObject>();
			if( spline == null )
				return;

			using( BeginGroup( "Selection" ) )
			{

				EditorGUILayout.BeginHorizontal();
				{

					if( GUILayout.Button( "Spline" ) )
					{
						Selection.activeGameObject = spline.gameObject;
					}

					if( GUILayout.Button( "Prev" ) )
					{
						var index = spline.ControlPoints.IndexOf( node.transform ) - 1;
						if( index < 0 )
							index = spline.ControlPoints.Count - 1;
						Selection.activeGameObject = spline.ControlPoints[ index ].gameObject;
					}

					if( GUILayout.Button( "Next" ) )
					{
						var index = spline.ControlPoints.IndexOf( node.transform ) + 1;
						if( index > spline.ControlPoints.Count - 1 )
							index = 0;
						Selection.activeGameObject = spline.ControlPoints[ index ].gameObject;
					}

				}
				EditorGUILayout.EndHorizontal();

			}

			using( BeginGroup( "Insert New Node" ) )
			{

				EditorGUILayout.BeginHorizontal();
				{

					if( GUILayout.Button( "Before" ) )
					{
						insertNodeBefore();
					}

					if( GUILayout.Button( "After" ) )
					{
						insertNodeAfter();
					}

				}
				EditorGUILayout.EndHorizontal();

			}

			using( BeginGroup( "Other Actions" ) )
			{

				if( GUILayout.Button( "Split Spline" ) )
				{
				}

			}

		}