Reputation: 35
I am using Visual Studio and I have followed the previous answers to this question where I just need to add the reference in my Solution Explorer. I have already done it but in my Unity3d, it still says The type or namespace name 'Forms' does not exist in the namespace 'System.Windows' (are you missing an assembly reference?)
Is there another way to fix this?
Upvotes: -1
Views: 623
Reputation: 4059
Unity will add project references to its known libraries, or those that you manually add to the Plugins folder. But even then, the known libraries are often stubs, and the manually added plugins need to be compatible. Unlike standard VS project, it won't pick up all of the libraries you have on your local machine.
To illustrate the point, if you want to use System.Text.Json, you need to manually download that dll and all the dependancies, and add those to the Plugins folder. After that you will then have access to the System.Text.Json namespace. So, in some cases it can be done.
What you shouldn't ever be doing with a Unity project, is to try and add your own references through Visual Studio to the project yourself. Unity is in control of your Solution and Project files, and will overwrite your references as it needs to.
That part explains why you aren't able to add System.Windows.Forms to you project through Visual Studio. Now comes the point where we ask why you would even try and add that to a Unity project. Unity has its own GUI systems (in my opinion, the better, although still green around the gills, being UI Toolkit). You CAN drive native Windows features from within Unity, but that's another question altogether. When using Unity, it's simplest to work within the bounds of the engine.
Upvotes: 1