Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

System.Windows.Forms

Discussion in 'Scripting' started by borrrden, May 11, 2009.

  1. borrrden

    borrrden

    Joined:
    May 6, 2009
    Posts:
    20
    Hello,

    I ran into a problem earlier trying to use System.Linq in my unity project. I realized that this is because Unity uses .NET 2.0, and so I was not allowed to use that DLL. However, I am trying to use System.Windows.Forms now, and I get this message inside Unity:

    "error CS0234: The type or namespace name `Windows' does not exist in the namespace `System'. Are you missing an assembly reference?"

    This is the same message I got with System.Linq, but System.Windows is .NET 2.0, and is even included in the mono directory in the Unity folder. What do I need to do to get it to recognize this library? Am I not allowed to use it? I am trying to get a Save File Dialog box to open for the user to save their settings into an INI file.
     
  2. borrrden

    borrrden

    Joined:
    May 6, 2009
    Posts:
    20
    Well, don't worry about it. I found this resource that helped me out:

    http://www.unifycommunity.com/wiki/index.php?title=FileBrowser

    Although it didn't work right out of the box, I was able to modify it to work. The trouble is that a directory can also be compressed so the line "if (fileSelection.Attributes == FileAttributes.Directory)" doesn't work right since it will return Directory, Compressed instead of just directory. I don't actually know what compressed means so I checked for both cases....Directory is 2048 and Directory, Compressed is 2064, so it would be Attributes 100000010000 I believe....(as you can see I'm just thinking of using the bit operator now :p).
     
  3. ghostravenstorm

    ghostravenstorm

    Joined:
    Oct 18, 2015
    Posts:
    88
    Bad link is bad.
     
  4. Bunny83

    Bunny83

    Joined:
    Oct 18, 2010
    Posts:
    3,531
    Well, the wiki is dead for quite some time now. However we have the "wayback machine" (aka archive.org). Though the script is an ancient script that uses the old IMGUI system. It still works, but it's a really rudimentary file browser.