I have a problem. I want that if player click on StudyOutDoor, first the object move toward to the door, then change the scene in Unity. here is my code:
if (Physics.Raycast (clickPoint, out hitPoint)) {
if (hitPoint.collider.name == "StudyOutDoor") {
target.y = transform.position.y;
target.z = transform.position.z;
transform.position = Vector3.MoveTowards (transform.position, target, playerSpeed * Time.deltaTime);
sceneNumber = 3;
Application.LoadLevel("Corridor");
}
But it is just changing the scene without moving toward to the position I said. Please help.