x


Noob question: iTween Scale GameObject (Plane) in C#

Hey unity community,

im currently reading into working with the iTween plugin and encountered a problem. I want to scale a gameObject over time using iTween onMouseEnter, and reset it to the original value onMouseExit. Already tried different ways to do that, but im not getting forward, so i need your assistance. I guess i have to use iTween.ScaleBy.

using UnityEngine;
using System.Collections;

public class ResizeOnMouseOver : MonoBehaviour {


 // Use this for initialization
 void Start () {
 }

 void OnMouseEnter() {
 Debug.Log("MouseEnter");
     // Scale up code here
 }

 void OnMouseExit () {
 Debug.Log("MouseExit");
 // Reset to original scale here
 } 
}
more ▼

asked Aug 09 '12 at 12:00 PM

m0nky gravatar image

m0nky
1 1 2 2

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

iTween commands work in two ways. Either you use the minimum options version (which is quick and easy) or you use the Hashtable arguments (which is very slightly harder and not as quick).

The code below will use the first method.

GameObject obj = yourGameObject;  // Link to the gameobject you want to scale
Vector3 amount = new Vector3 (2,2,2); // Place desired scale amount here
float time = 3;   // Put your time here

iTween.ScaleBy(obj, amount, time);

Hope that helps!

more ▼

answered Aug 09 '12 at 01:02 PM

speedything gravatar image

speedything
425 1 4

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x426

asked: Aug 09 '12 at 12:00 PM

Seen: 427 times

Last Updated: Aug 09 '12 at 01:02 PM