Multiple Parameters through itween

All right, I’ve seen this question before. Here is my code.

iTween.ValueTo(gameObject, iTween.Hash("from", titleMenuRectStart, "to", titleMenuRectEnd,
                "easetype", iTween.EaseType.easeInOutExpo, "time", openTime / 3.0f,    "onupdate", "updateTitleMenu", "oncomplete", "startDescriptionButtonTween"));

Now I want to add in “oncompleteparams” to pass in two variables that I need for another tween. People have pointed to the documentation and it doesn’t say, so please no posts directing me there.

I’m just looking for an example of the syntax to pass multiple variables through the params call in the hash table. If it can’t be done, please say that. I don’t mean to sound mean, but I’ve seen the question asked multiple times and there is no one answering the question. Any help would be greatly appreciated.

1 Answer

1

You can create an object that you want to send back to it and have those values:

So if you wanted to use say a Vector3:

Hashtable param = new Hashtable();
Vector3 someVals = new Vector3(100.0f, 30.0f, 20.0f);
param.Add("oncomplete", "OnComplete");
param.Add("oncompleteparams", someVals);
iTween.ValueTo(gameObject, param);

then in the callback:

public void OnComplete(object vals){

      Debug.Log("some values" + (Vector3)vals);

}

Make sure to cast the object that is passed into the on complete method.

Thank you for the response and the code example. However, that is passing a single variable (a vector3) through iTween. I'm asking if there is a way to pass multiple variables through. Like if I wanted to pass a string and a vector3 through on the same completeparams function. I'm sorry if I made that unclear in my post.

Thank you very much. This definitely answered my question. I still need to go back through and rewrite my code as it's very complicated right now, so it kinda' mooted the point, but it's still great to finally know the answer to this. Thank you very much.