No appropriate version of 'iTween.PutOnPath' for argument list ... was found

I’m trying to instantiate and then place an object on a path and allow the user to move the object along the path. I’m using iTween without success and have been trying various things for a week (I’m new to this). I confirmed that I’ve iTween, iTweenPath, and iTweenPathEditor in my Plugins folder (I notice that Mono editor still doesn’t recognize the iTween functions as I type). Unity is giving me this error:

Assets/Mellon/Scripts/Object Path
Script.js(2,25): BCE0023: No
appropriate version of
‘iTween.PutOnPath’ for the argument
list ‘(System.Type,
System.Collections.Hashtable, int)’
was found.

This is my GUI Script.js

//This script instantiates objects using the GUI

var prefab1 : GameObject;
var prefab2 : GameObject;
var prefab3 : GameObject;
var prefab4 : GameObject;
var prefab5 : GameObject;

function OnGUI () {
	// Make a background box
	GUI.Box (Rect (10,10,100,240), "Create Bead");

	// Make the first button. If it is pressed, Round Sm bead will be created
	if (GUI.Button (Rect (20,40,80,30), "Round Sm")) {
		//Instantiate the object at the position and rotation of this transform
		var instance1 : GameObject = Instantiate(prefab1, Vector3(10,50,-20), transform.rotation);
	}

	// Make the second button. If it is pressed, Round Lg bead will be created
	if (GUI.Button (Rect (20,80,80,30), "Round Lg")) {
		var instance2 : GameObject = Instantiate(prefab2, Vector3(10,50,-20), transform.rotation);
	}

	// Make the third button. If it is pressed, Rondel bead will be created
	if (GUI.Button (Rect (20,120,80,30), "Rondel")) {
		var instance3 : GameObject = Instantiate(prefab3, Vector3(10,50,-20), transform.rotation);
	}

	// Make the fourth button. If it is pressed, Oval Sm bead will be created
	if (GUI.Button (Rect (20,160,80,30), "Oval Sm")) {
		var instance4 : GameObject = Instantiate(prefab4, Vector3(10,50,-20), transform.rotation);
	}
	
	// Make the fifth button. If it is pressed, Oval Lg bead will be created
	if (GUI.Button (Rect (20,200,80,30), "Oval Lg")) {
		var instance5 : GameObject = Instantiate(prefab5, Vector3(10,50,-20), transform.rotation);
	}

}

This is Object Path Script.js

function Update () {
	iTween.PutOnPath(GameObject, iTween.Hash("path", iTweenPath.GetPath("beadstring")), 0);

	}

Any suggestions what for needs to be changed? Thanks!

function Update () {
iTween.PutOnPath(GameObject, iTween.Hash(“path”, iTweenPath.GetPath(“beadstring”)), 0);

}

So, see the bit where you have GameObject… well you’re declaring a Type there, not an actual gameObject.

Change GameObject to gameObject so that it refers to the gameObject instead…, function Update () {
iTween.PutOnPath(GameObject, iTween.Hash(“path”, iTweenPath.GetPath(“beadstring”)), 0);

}

Check where it says GameObject, it should say gameObject for a start, no?

You’re using the

iTween.Hash();

method of creating your hash table which is only supported in the c# version of iTween I believe. You need to call it using the inline Hash table creation method for javascript:

http://itween.pixelplacement.com/gettingstarted.php

I’m not quite sure how using GetPath would work with it all, so you may have to experiment with that.

It appears you’re just using the function the wrong way. According to iTween’s Documentation, PutOnPath only accepts the following parameters in the order shown:

  • PutOnPath(GameObject target, Vector3 path, float percent)
  • PutOnPath(GameObject target,Transform path, float percent)
  • PutOnPath(Transform target, Vector3 path, float percent)
  • PutOnPath(Transform target, Transform path, float percent)

You used:

  • iTween.PutOnPath(GameObject, iTween.Hash(“path”, iTweenPath.GetPath(“beadstring”)), 0);

…and PutOnPath does not take the HashTable parameter you used (i.e. iTween.Hash). I would suggest using something else (such as iTween.MoveTo function, which does use HashTables), but you know best what you need your code to do. Refer to the documentation for more information on iTween functions.