Script problem : an item with the same key as already been added. (Error:System.ArgumentException)

Hi !

Everything is in the title. This is my script :

using UnityEngine;
using System.Collections;

public class CursorScript : MonoBehaviour
{
// Use this for initialization
void Start ()
{
//Set Cursor to not be visible
Cursor.visible = false;
}
}

Do you know a solution ?

Thx you

There is no way that’s the script causing that.

That exception you’re getting is usually thrown by a Dictionary, and you don’t have a Dictionary in your code.

Oh, and use the CODE blocks next time you post code, it makes it more readable:

Ho ok thx for the link :wink: !

So it’s strange… Does anyone knows what can I do :confused: ?

using UnityEngine;
using System.Collections;

public class CursorScript : MonoBehaviour
{
// Use this for initialization
void Start ()
{
//Set Cursor to not be visible
Cursor.visible = false;
}
}

Do you have any other scripts?

Maybe one with a Dictionary being used in them?

In fact, to explain everything, I have reformatted my computer and I have recovered a last project. I had difficulties to recover it. In my initial project, I had the same script, but it disapears in the recover project. That’s why I wanted to create this “new script”. There is no solution to wash the dictionnary or something like that ?

And I have a lot of scripts in my FPS CAMERA, like motion blur, antialiasing, etc…

“wash the dictionary” ? what? That’s not a thing.

How do you know its CursorScript with the error?

What’s the actual print out of the exception? Because usually Unity it includes the line of code that it occurs on.