0

I'm facing a problem with displaying a Winform I've created in the unity editor, for some reason the form is not displaying as it should in the unity editor...

  • most controls in the form have the "autosize" property set to true and the "autoSizeMode" property set to "GrowAndShrink". and whenever I display the form in the unity editor, these controls just vanish.. their size is set to (0,0) regardless of the inner controls they hold. (setting manually the "minimumSize" property of these controls does makes them visible again.)

  • the "sutoScroll" property is not displaying the sliders.

  • the "dock" property is not acting as it should.

some of the majors I've taken:

  1. I've added the right dlls (such as the "system.windows.forms.dll) to the unity project.

    I've merged the ".cs" and ".designer.cs" of each form into a single file, so I won't face this problem "Form and designer files not linking in Solution Explorer", and I copied them to the unity project.

  2. I've tried making a "class library" project and copy the forms into it. placing the build/debug dll in the unity project and displaying the form. (still the same result though)

  3. I've copied the ".exe" of the winform project to unity, and calling/displaying the exe does show the form correctly, but I want to be able to share collection references between the exe and unity editor... and from what I've read online don't think it's passable ..

any suggestions on how to resolve the issue? or no how to display a Winform in unity editor without it getting all messed up, and share argument references between the both?

this is an image of the winform running in visual studio:

img1

this is an image of the form displayed through unity:

img2

this is a link to the Winform project

Maurice
  • 1
  • 1
  • You are trying to use Winform in Unity? The game engine? – Programmer Jan 14 '18 at 22:14
  • 1
    yeah, but as a plugin to the engine and not an in-game thing – Maurice Jan 14 '18 at 22:28
  • 1
    Unitiy has it's own [UI system](https://docs.unity3d.com/Manual/gui-Basics.html) for plugins for the engine, you need to use those controls, not winforms. see also https://docs.unity3d.com/Manual/editor-CustomEditors.html – Scott Chamberlain Jan 14 '18 at 22:32
  • thanks, I do know that already, and I did use it before to build other plugins. but building a form/GUI in winforms is way simpler and faster than using the custom unity editor, and that's why I'm asking if there's a way import a winform to unity. – Maurice Jan 14 '18 at 23:00
  • Mono WinForms is an incomplete technology. Give it up and go back to the right track as others commented. – Lex Li Jan 15 '18 at 01:11
  • I was trying to confirm that you this is actually what you are trying to do. Don't attempt to do this because it will only work on Windows OS. This removes the main reason of using Unity which is to build your app for mobile devices and other platforms. Learn Unity UI. – Programmer Jan 15 '18 at 04:29
  • @Programmer it shouldn't affect the games/final product as it is a tool used only inside the editor – Maurice Jan 15 '18 at 10:52
  • @LexLi it's really annoying though :/ ... anyways thanks, it's probably what I'll end up doing. – Maurice Jan 15 '18 at 11:55
  • IMGUI Mentioned by scott is part of Unity. That's made for building tools in the Editor. – Programmer Jan 15 '18 at 13:55

0 Answers0