I'm developing a multimedia app using C# and Unity.
In this app, user can move an object using mouse wheel; so I wrote
private void MoveObjectUpDown(float value)
{
MyObject.transform.position = MyObject.transform.position + new Vector3(0, value, 0);
StartCoroutine(UpdateObjectPositionToServer(MyObject.transform.position, MyObject.MyObjectID);
}
MyObjectUpAndDown is called from Update checking
Input.GetAxis("Mouse ScrollWheel");
UpdateObjectPositionToServer is a call to a web service; in this web service I update a MySql Table via Query.
As you can imagine, if user move whell mouse to move my object, there will be a lot of call to UpdateObjectPositionToServer; my question is:
Which approach Can I use not to call UpdateObjectPositionToServer after each user movement, but just one time , at the end of user movement (maybe, 1 or 2 seconds user don't move that object ) ?