Jump to content

PartTools TextMeshProResolver.cs [InitializeOnLoad] Issues [Possibly Solved?]


Recommended Posts

Possible half-cheeks solution 2/3 of way down after TLDR;

As a complete newbie trying to figure out how to make my plugin, I tried following the (only) two GUI guides I could find, Dmagic's and Fengist. (Links at end)

I had the same issue with both when it came to building the AssestBundle using PartTools. I'm using Unity 2019.2.2f1 and I think I followed the installation and setup for PartTools correctly.

First I created my new project, then went to Window->Package Manager. Clicked on TextMeshPro 2.0.1 and then clicked the Remove button.

Then  I followed the link to TextMesh Pro Release 1.0.56-Unity 2017.3 which is a google drive with a long list of seemingly random folder names. I clicked the download button and this downloaded a file called "TextMesh Pro - Release 1.0.56.2017.3.0b2 (dll only).unitypackage" which I double clicked to import/install. I clicked on the All and then Import buttons in the dialog box that popped up.

Next I downloaded and unzipped the latest PartTools using the link from PartTools forum topic, and again imported by double clicking on the "PartTools_AssetBundles.unitypackage" file and again clicking on the All then the Import buttons on the new dialog box.

Next, I clicked on the Assets/Plugins/KSPAssetCompiler.dll (Couldn't find KSPAssedCompiler.dll so I'm assuming its a typo in the instructions) and made sure Validate References in the inspector panel was unchecked (Which it was for me).

Lastly, I did the same for Assets/Plugins/KSPAssets.dll which was originally had Validate References checked, so I uncecked it and then clicked on the Apply button at the bottom of the Inspector panel.

This ended what I thought was the setup for PartTools, but everytime I tired to use KSPAssets->Asset Compiler->Build I would get the following 3  errors

Assets\Plugins\KSPAssets\TextMeshProResolver.cs(12,6): error CS0246: the type or namespace name 'InitializeOnLoadAttribute' could not be found (are you missing a using directive or an assembly reference?)

Assets\Plugins\KSPAssets\TextMeshProResolver.cs(12,6): error CS0246: the type or namespace name 'InitializeOnLoad' could not be found (are you missing a using directive or an assembly reference?)

Error building Player because scripts had compile errors

and my AssetBundle would not be created.

If I double click on the error to open the TextMeshResolver.cs file in Visual Studio though it all looks fine, the reference works and the file compiles, so its just a unity compiler issue.

TLDR;

To fix it I just commented out line 12 [InitializeOnLoad] of TextMeshResolver.cs

Not sure if this is gonna bite me in the cheeks later but at least I've got my assestbundle now and can continue with the tutorials.

I have no idea what this line does so if I've just done a dumb thing please someone tell me.

Also, if anyone can point me (and others) to more up-to-date GUI creation tutorials, from what I've read so far there are now four methods of GUI creation:

OnGUI

EzGUI

SSUI

Unity 5 Canvas-based (Which I think is the one used in the two tutorials I mentioned, at least they both use a Canvas Object)

 It's hard to distinguish which is newer or better or easier or what the advantages or disadvantages of each are. Not to mention, trying understand which method the various code samples and source you find are using.

Getting some content on the https://wiki.kerbalspaceprogram.com/wiki/GUI_Tutorial page would be best because it seems to come up most often in my google searches for KSP GUI help.

Anyway, any help, or even a message saying you feel my pain will be appreciated, lets me know I'm not just screaming into the void.

 

Edited by Coyote21
Make more readable for anyone finding from search/google
Link to comment
Share on other sites

There are three ways major ways to create a UI. First being the legacy IMGUI system, which is a fully code approach for creating UIs. It’s pretty easy to get into, but the performance is really bad compared to other approaches. (As it’s redrawn every frame) Don’t use it for really large complex UIs with a lot of objects.

Then there’s the uGUI system (unity prefabs). This means creating the UI in unity, exporting it as a AssetBundle and hooking it up via code. Has much better performance and is really customizable. Tho, It’s harder to get into. 

There’s also ways to do uGUIs but with full code approach, which is damn hard to get right and would require a lot of code. If I’m not mistaken sarbian and taniwha were working on a KSP library for this. 

Last but not least there’s the KSPs own PopupDialog class. It’s a full code approach, but mostly (as the name suggest) only meant for small popup windows. 

Edited by ValiZockt
Link to comment
Share on other sites

OK thanks for making that clearer, what you say certainly gels well with what I have read so far.

And thanks for replying, It's encouraging knowing someone is listening, seriously thanks.

But any tips, ideas or references telling me how I go about learning one of these three methods?

My GUI is exceedingly simple (a vertical row of up to max 9 small buttons) so any of the three would work, just need to learn one of them.

At this point I have my GUI functioning using the IMGUI system but lack of documentation on what is available from the ksp HighLogic skin is holding me back from finishing it. I really just want to be able to set a sunken look to a pressed button to turn it into a kind of toggle.

Of course I still need to figure out saving window positions and vessel-specific data, but other then that I'm done.

In case anyone is interested my (very WIP, changing hourly) code is on github at https://github.com/Coyote21/AGPanel

 

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...