# Unity can't add script component

I keep getting the following error when i try to drag and drop a script to my gameobject:

I have made sure that both my Script name and the class name is : Soldier as you can see:

public class Soldier : MonoBehaviour
{
public int Rank;
}


So my question is what have i done wrong?

• Will you restart Unity and try again? From your screenshot and code, seems nothing wrong. Jun 14 '18 at 10:11
• @modernator ive done that 5 times not luck :( Jun 14 '18 at 10:13
• Well then did you try with different file name and class name? Still have same error? Jun 14 '18 at 10:25

## 1 Answer

1. Fix compiler error.
2. Make sure you have "using UnityEngine;" in your namespace.
3. make sure you have the same names for classname and filename

I assume your file has a big "I" instead of a small "L" or a special character.

to check it paste both, the Filename here and then the Class name here:

https://www.textmagic.com/free-tools/unicode-detector

Compare for special characters. (red)

i != í for example

You might have accidently pushed ´ or ` something before pushing the i button, resulting in a different class name than file name.

To make it 100% sure copy and paste the classname to the filename.