iTween Scripting Issue

I’m having a bit of trouble here. I’m sure it’s an obvious fix… Basically, I’m trying to change the size, rotation, and position of a game object through iTween, on mouse hover. When the mouse is no longer hovering, I want the object to go back to it’s original size, position, and rotation. Here’s what I have so far…

using UnityEngine;
using System.Collections;

public class TourButton : MonoBehaviour {

void Start() {
iTween.MoveFrom(gameObject, iTween.Hash(“y”, 10, “time”, 5.0));
}

void OnMouseOver() {
//Reason: Mouse-over animation to swing out on hover.
iTween.RotateBy(gameObject, iTween.Hash(“z”, 70, “time”, 0.25));
iTween.MoveFrom(gameObject, iTween.Hash(“y”, 9, “time”, 0.25));
iTween.ScaleBy(gameObject, iTween.Hash(“x”, 2, “time”, 0.25));
}

void OnMouseUp() {
Application.LoadLevel (“YearSelectMenu”);
}
}

Instead of stopping after mouse hover is off the object, the object glitches out and disappears.

Help would be appreciated.

using UnityEngine;
using System.Collections;

public class TourButton : MonoBehaviour {

void Start() {
iTween.MoveFrom(gameObject, iTween.Hash(“y”, 10, “time”, 7));
//iTween.PunchPosition (gameObject, iTween.Hash (“z”, -0.8, “time”, 5.5));
}

void OnMouseOver(bool on) {
//Reason: Mouse-over animation to swing out on hover.
//Not Working Due to Glitch. “Calling function OnMouseOver with no parameters, but the function requires 1”
if(on) {
iTween.RotateBy(gameObject, iTween.Hash(“z”, 70, “time”, 0.25));
iTween.MoveFrom(gameObject, iTween.Hash(“y”, 9, “time”, 0.25));
iTween.ScaleBy(gameObject, iTween.Hash(“x”, 2, “time”, 0.25));
}
else {
iTween.RotateBy(gameObject, iTween.Hash(“z”, 0, “time”, 0.25));
iTween.MoveFrom(gameObject, iTween.Hash(“y”, 0, “time”, 0.25));
iTween.ScaleBy(gameObject, iTween.Hash(“x”, 1, “time”, 0.25));
}
}

void OnMouseUp() {
//Delete slashes once menu level is made.
//Application.LoadLevel (“YearSelectMenu”);
}
}

Updated script seems correct, but getting error, “Failed to call function OnMouseOver of class TourButton”

Can anyone help, but I’m not stumped!

By not stumped, I mean stumped.

I don’t mean to spam, but I’m trying every way of doing this!

PLEASE HELP!!! Someone!?

I would still like help? Does anyone respond on here?

Sorry, but I’m still looking for a solution to this problem. I even bought a C# reference book from O’Reilly to help, but so far… nothing.

Is it the void Start() function? Is there something to override void start() to allow the class to continue with void OnMouseOver(bool on)?

Full Code:

using UnityEngine;
using System.Collections;

public class TourButton : MonoBehaviour {

	void Start() {
		iTween.MoveFrom(gameObject, iTween.Hash("y", 10, "time", 7));
	}
	
		void OnMouseOver(bool on) {
		//Reason: Mouse-over animation to swing out on hover.
		//Not Working Due to Glitch. "Calling function OnMouseOver with no parameters, but the function requires 1"
			if(on) {
				iTween.RotateBy(gameObject, iTween.Hash("z", 70, "time", 0.25));
				iTween.MoveFrom(gameObject, iTween.Hash("y", 9, "time", 0.25));
				iTween.ScaleBy(gameObject, iTween.Hash("x", 2, "time", 0.25));
			}
			else {
				iTween.RotateBy(gameObject, iTween.Hash("z", 0, "time", 0.25));
				iTween.MoveFrom(gameObject, iTween.Hash("y", 0, "time", 0.25));
				iTween.ScaleBy(gameObject, iTween.Hash("x", 1, "time", 0.25));
			}
		}

		void OnMouseUp() {
			//Delete slashes once menu level is made.
			//Application.LoadLevel ("YearSelectMenu");
		}
	}