iTween Paths : Element with the same key already exists in the dictionary

I have a menu which is a duplicate of my main game scene with a flythrough camera.

I have a main game scene where I have several objects which follow iTweenPaths.

I have a duplicate of this scene, just without the player, with a camera flythrough for the main menu.

When the menu scene loads the game scene I get the following:

ArgumentException: An element with the same key already exists in the dictionary. System.Collections.Generic.Dictionary`2[System.String,iTweenPath].Add (System.String key, .iTweenPath value) iTweenPath.OnEnable () (at Assets/Plugins/iTweenPath.cs:17)

I understand the error, keys are unique and the paths are already added within the menu scene but I don't know how to correct it?

Change blah.Add(key, value) to blah[key] = value;

The former throws an exception when adding a duplicate key, while the latter doesn't.

Have you tried the most recent iTweenPath from my blog? If so can you send me a project that I can take a look at?

I added these lines before line 17 and I no longer get that error, Im moving the path nodes around in my script, and the changes were not taking effect when I loaded the scene, then left, and loaded the scene again. The 2 lines below are a quick fix, pixelplacement maybe you want to look into this?

    if(paths.ContainsKey(pathName.ToLower()))
        paths.Clear();

        paths.Add(pathName.ToLower(), this);

Mike 3 has it right in general terms above.

The actual change to iTweenPath.cs that I made is:

	void OnEnable(){
	if(!paths.ContainsKey(pathName)){
		//paths.Add(pathName.ToLower(), this);
		paths[pathName.ToLower()] = this; // updated from answers.unity3d.com/questions/49137
	}
}

As you can see I commented out the original line and added the replacement line:
paths[pathName.ToLower()] = this;

This fix works my situation when I was instantiating the same prefab from a spawn point multiple times.
Hope this makes it easier for all.

Oz.

Oh my god thanks guys so much for the easy fix… Much appreciated…