- Home /
iTween Visual Editor Event Call from C# to Javascript
Hello, I realize what I am asking, I will learn C# soon, but is there any one thats willing to give a couple seconds of their time to help me figure out how to write an iTween event call in Javascript? I know how to write Javascript pretty well. I'm lost with c# currently :P
//Do i need to define this in Javascipt? What is its function?
public class StartAndStopTween : MonoBehaviour {
//This is what I'm really interested in.
iTweenEvent.GetEvent(target, "Bounce").Play();
}
Thank You! Daniel
Answer by Em3rgency · Jul 03, 2013 at 10:45 PM
You don't need to define the StartAndStopTween class, if you don't want to. At least, from the snippet you show.
As for the iTweenEvent call, its just a regular function. Function calls are the same in both c# and js, as far as I know. Just make sure iTweenEvent is properly defined (because its not in this script, and its not a built-in thing, at least not in MY unity). And yeah, if you want code rewritten, give the whole code.
Hello, @Em3rgency I took understand your suggestion but i think that the BOUNCE is referring to the NA$$anonymous$$E of the iTween Visual Editor Script component that i made.
Here is the full code I will be using, And a picture of the NA$$anonymous$$E var i am talking about, also this is not a standard iTween event call i dont think, this is an extension made by another guy other than robert.
In the picture the NA$$anonymous$$E is highlighted in BLUE
var initialColor:Color;
var SelectColor:Color;
var SelectSound : AudioClip;
var FingerOverSound : AudioClip;
//var CrashSound : AudioClip;
function Start()
{
initialColor = renderer.material.color;
}
function On$$anonymous$$ouseExit(){
renderer.material.color = initialColor;
}
function On$$anonymous$$ouseOver(){
renderer.material.color = SelectColor;
}
function On$$anonymous$$ouseEnter () {
audio.clip = FingerOverSound;
audio.Play();
}
function On$$anonymous$$ouseDown () {
audio.clip = SelectSound;
audio.Play();
//$$anonymous$$ove to multiplayer$$anonymous$$enu First
//Cause the menu to FALL to the Ground
rigidbody.constraints = RigidbodyConstraints.None;
iTweenEvent.GetEvent(target, "$$anonymous$$ain$$anonymous$$enuTo$$anonymous$$ultiplayerOptions").Play(); //This is the line.
}
Also if you want this extension, it is FREE! just go to http://itween.pixelplacement.com/gettingstarted.php and find the "iTween Visual Editor" click on the link and download it from the asset store its a great tool! I just need to learn how to CALL the events from the COD$$anonymous$$ :D
Ok, so does iTweenEvent.GetEvent(target, "$$anonymous$$ain$$anonymous$$enuTo$$anonymous$$ultiplayerOptions").Play(); work or not?
Because your question is in c#, your new example is in js. As you can see the calls are exactly the same. No conversion needed.
And for the record, you should really ask this sort of thing at itween, whoever made that, not at unity answers :)
Yes got it to work! It was $$anonymous$$y own fault! I read that you had to have the iTween.cs in the plugins folder, For any one else in countering an error with iTween Visual Editor while using java script do this:
iTween Visual Editor version 0.6.1
After installation, if you have a Javascript based project it is highly recommended that you run the "Component/iTween/Prepare Visual Editor for Javascript Usage" command. This will copy files into your Plugins directory which is necessary for the visual editor events to be called from Javascript. C# based projects require no further configuration.
Thanks for the help em3rgency! $$anonymous$$
Your answer
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
Parent Object Via Code C# 3 Answers
Changing material Color using RBG? 3 Answers
Has anyone got a Toggle key script? 3 Answers
Player Jumps instead of moving forward 0 Answers