As I drag my EmptyObjects of my puzzle after I move a piece,the piece keeps on movin

I have copied my Update of ObjectmovementControl script.Atfirst,when I click and drag my mousepointer,the PuzzlePiece move in the desired way.But if I intentionally try to click on an emptyspace(I put Emptyobject there),the previous update keeps on running…i,e the previous puzzle piece moves on. Please let me know my coding fault.:face_with_spiral_eyes:

void Update ()
{

if(mMovestart ) // initially mMovestart= false,so the loop doesnot run when mMovestart=False,it only runs when mMovestart=True
{

_currentObject.position = Vector3.MoveTowards(_currentObject.position,mtargetPos,_movingSpeed*Time.deltaTime);

if(Vector3.Distance(_currentObject.position,mtargetPos)<.1f) // when _currentObject and mTargetPos approaches to zero
{
_currentObject.position = mtargetPos ;

_currentMovingstate = eMovingState.InitialState ;

mMovestart = false ;//in order to keep the condition false .

}
}

}

Set _currentObject back to null after you drop the piece.

oh,grt !! problem solved ,Thnx @wccrawford :smile: