- Home /
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!
Answer by pixelplacement · May 14, 2010 at 07:02 AM
Actually you'll need cam to be a GameObject and the callback needs to be sent as a string: "onComplete": "toggleActive"
Hope that helps!
Answer by Mike 3 · May 11, 2010 at 04:02 PM
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
Your answer
Follow this Question
Related Questions
Cannot cast from source to destination type 1 Answer
InvalidCastException: Cannot cast from source type to destination type. 4 Answers
Cannot cast from source type to destination type ERROR! 2 Answers
C# Getting "Cannot cast from source type to destination type" even though it's working. 1 Answer
"Cannot cast from source type to destination type" 2 Answers