"Add Component" button doesn't work!

Well this is strange, I’m now at the begining stage of my serious project, well whenever I click on “Add Component” button on a gameobject it doesn’t work, and it gives me this red error in the console:

NullReferenceException: Object reference not set to an instance of an object
UnityEditor.EditorWindow.Close () (at C:/BuildAgent/work/812c4f5049264fad/Editor/MonoGenerated/Editor/EditorWindow.cs:488)
UnityEditor.AddComponentWindow.Show (Rect rect, UnityEngine.GameObject gos) (at C:/BuildAgent/work/812c4f5049264fad/Editor/Mono/Inspector/AddComponentWindow.cs:381)
UnityEditor.InspectorWindow.AddComponentButton (UnityEditor.Editor editors) (at C:/BuildAgent/work/812c4f5049264fad/Editor/Mono/Inspector/InspectorWindow.cs:1037)
UnityEditor.InspectorWindow.OnGUI () (at C:/BuildAgent/work/812c4f5049264fad/Editor/Mono/Inspector/InspectorWindow.cs:269)
System.Reflection.MonoMethod.Invoke (System.Object obj, BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object parameters, System.Globalization.CultureInfo culture) (at /Applications/buildAgent/work/3df08680c6f85295/mcs/class/corlib/System.Reflection/MonoMethod.cs:222)

I need help, I don’t want to start on a new project! Thanks

Ok so until Unity fix this I’ve created a package that simulates the functionality with the following restrictions:

  • There is a new “Add New Component” menu at the bottom of the transform inspector and at the bottom of the Components menu
  • Newly created scripts are c# or unity script and you can add more locations/source types as you wish
  • Newly created scripts are added just after they have compiled which means it won’t add immediately if your code is already broken :slight_smile:

Available here

The issue is caused (at least for me) by having unity 3 and unity 4 installed on the same machine. Once i removed unity 3 and reinstalled unity 4 the problem went away.

Run the program as administrator, that fixed it for me.

Try creating a new blank project, if you still have the same issue, try re-installing Unity. And if the problem persists send a bug report with the blank project as sample.