iTween-Error :: "Cannot cast from source type to destination type"

Hi there!

I got this error

Cannot cast from source type to destination type.

when I use this script to move the camera

function OnMouseEnter()
{
    //Camera.main.GetComponent(CameraMover).MoveToPosition();
    camPosX = cam.transform.position.x;
    camPosY = cam.transform.position.y;
    if(!isActive) iTween.moveTo(cam,{"y":(camPosY+100), "x":(camPosX + 100) , "time":2, "transition":"easeOutExpo"});
    toggleActive();
}

function OnMouseExit()
{
    if(isActive) {
    iTween.stop(cam);
    iTween.moveTo(cam,{"y":camPosY, "x":camPosX, "time":1, "transition":"easeOutExpo", "onComplete": toggleActive});
    }
}
function toggleActive()
{
    isActive = !isActive;
    Debug.Log("isActive: " + isActive);
}

Why is that?

Thnx!

Actually you'll need cam to be a GameObject and the callback needs to be sent as a string: "onComplete": "toggleActive"

Hope that helps!

It probably needs to be cam.transform for all of those cam references - i haven't used the library but my guess is it takes transforms to move objects