Jump to content

Help with GUIs


prgmTrouble

Recommended Posts

Note: This is my first day programming with Unity and C# :P

So I've created a GUI in Unity (it works just as I want it to) but I have not been able to run it in KSP. Specifically, I cannot get the Part Tools asset compiler to turn out a dll file. I've done everything I could find and nothing works. 

GitHub: https://github.com/prgmTrouble/ShipOrganizer

Thanks in advance!

Link to comment
Share on other sites

Unless I'm way off base Unity doesn't output a Dll. Here's a link to a tutorial - part way down is a section on outputting from Unity and connecting up in code.

 

Edited by wasml
removed mis-information
Link to comment
Share on other sites

1 hour ago, wasml said:

Unless I'm way off base Unity doesn't output a Dll.

Yeah, you're pretty far off base. :)

These lines set the projects' output file names:

https://github.com/prgmTrouble/ShipOrganizer/blob/master/ShipBrowser.csproj#L10

    <AssemblyName>Assembly-CSharp</AssemblyName>

https://github.com/prgmTrouble/ShipOrganizer/blob/master/ShipBrowser.Editor.Plugins.csproj#L10

    <AssemblyName>Assembly-CSharp-Editor-firstpass</AssemblyName>

You probably want to change Assembly-CSharp to ShipBrowser and Assembly-CSharp-Editor-firstpass to ShipBrowser.Editor.Plugins. With that change, `xbuild` gives me your DLLs.

Edited by HebaruSan
Link to comment
Share on other sites

Thanks for the input! 

One problem...I have no clue what 'xbuild' is. I (again) couldn't find any relevant answers on the internet (or maybe I'm using the wrong command prompt), so can someone tell me how that works?

Thanks again!

Link to comment
Share on other sites

53 minutes ago, prgmTrouble said:

One problem...I have no clue what 'xbuild' is. I (again) couldn't find any relevant answers on the internet (or maybe I'm using the wrong command prompt), so can someone tell me how that works?

It's a build tool for Mono, which reads your sln and csproj files and then follows their instructions to compile your code. I use it instead of the Unity tools, but Unity must have something equivalent.

http://www.mono-project.com/docs/tools+libraries/tools/xbuild/

Link to comment
Share on other sites

3 hours ago, prgmTrouble said:

I already tried the VS IDE and the Unity popup, both throw nonsensical errors. I did manage to find a bunch of "xbuild" files though.

Well, there are also some syntax errors in the code on Github. I fixed them because I thought this was an old junk commit and you would have fixed them already when trying to compile.

What's the license for this mod? I'll put the changes that fix it for me on Github if I'm legally allowed to.

Link to comment
Share on other sites

1 minute ago, prgmTrouble said:

The console still says that xbuild is not a valid command, and unity does nothing when i try to build. How exactly did you build it? 

What about Visual Studio? That's the one that I think will work for you.

(I just ran xbuild, but that's not relevant if you don't have xbuild.)

Link to comment
Share on other sites

In VS, I got

1>------ Build started: Project: ShipOrganizer-master, Configuration: Debug Any CPU ------
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1964,5): warning MSB3268: The primary reference "Ookii.Dialogs" could not be resolved because it has an indirect dependency on the framework assembly "System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v3.5,Profile=Unity Subset v3.5". To resolve this problem, either remove the reference "Ookii.Dialogs" or retarget your application to a framework version which contains "System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1964,5): warning MSB3268: The primary reference "Ookii.Dialogs" could not be resolved because it has an indirect dependency on the framework assembly "System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v3.5,Profile=Unity Subset v3.5". To resolve this problem, either remove the reference "Ookii.Dialogs" or retarget your application to a framework version which contains "System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1964,5): warning MSB3268: The primary reference "Ookii.Dialogs" could not be resolved because it has an indirect dependency on the framework assembly "System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v3.5,Profile=Unity Subset v3.5". To resolve this problem, either remove the reference "Ookii.Dialogs" or retarget your application to a framework version which contains "System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
1>C:\Users\user1\Desktop\Developer\KSP\ShipOrganizer-master (1)\ShipOrganizer-master\Assets\StandaloneFileBrowser\StandaloneFileBrowserWindows.cs(7,7,7,12): error CS0246: The type or namespace name 'Ookii' could not be found (are you missing a using directive or an assembly reference?)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

even though I did try to include a reference to the 'Ookii' file in question.

Link to comment
Share on other sites

3 minutes ago, prgmTrouble said:

In VS, I got


1>------ Build started: Project: ShipOrganizer-master, Configuration: Debug Any CPU ------
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1964,5): warning MSB3268: The primary reference "Ookii.Dialogs" could not be resolved because it has an indirect dependency on the framework assembly "System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v3.5,Profile=Unity Subset v3.5". To resolve this problem, either remove the reference "Ookii.Dialogs" or retarget your application to a framework version which contains "System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1964,5): warning MSB3268: The primary reference "Ookii.Dialogs" could not be resolved because it has an indirect dependency on the framework assembly "System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v3.5,Profile=Unity Subset v3.5". To resolve this problem, either remove the reference "Ookii.Dialogs" or retarget your application to a framework version which contains "System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\Microsoft.Common.CurrentVersion.targets(1964,5): warning MSB3268: The primary reference "Ookii.Dialogs" could not be resolved because it has an indirect dependency on the framework assembly "System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" which could not be resolved in the currently targeted framework. ".NETFramework,Version=v3.5,Profile=Unity Subset v3.5". To resolve this problem, either remove the reference "Ookii.Dialogs" or retarget your application to a framework version which contains "System.Security, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".
1>C:\Users\user1\Desktop\Developer\KSP\ShipOrganizer-master (1)\ShipOrganizer-master\Assets\StandaloneFileBrowser\StandaloneFileBrowserWindows.cs(7,7,7,12): error CS0246: The type or namespace name 'Ookii' could not be found (are you missing a using directive or an assembly reference?)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========

even though I did try to include a reference to the 'Ookii' file in question.

Did you try removing that reference? That error means you can't use Ookii.Dialogs in KSP mods.

Quote

To resolve this problem, either remove the reference "Ookii.Dialogs" or retarget your application to a framework version which contains "System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a".

 

Link to comment
Share on other sites

Just now, prgmTrouble said:

now 


The type or namespace name 'StandaloneFileBrowserWindows' could not be found (are you missing a using directive or an assembly reference?)

showed up

Did you take all the changes? This should be prevented by the removal of UNITY_STANDALONE_WIN from the csproj files.

Link to comment
Share on other sites

9 minutes ago, prgmTrouble said:

Is there anything else that needs to be done to make this compatible with KSP? 

Well, I don't see anything so far that would do anything in KSP. You'd need either a class inheriting from PartModule or one inheriting from MonoBehaviour and tagged with the KSPAddon attribute for KSP to load your code and run it.

 

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...