Jump to content

Unity to KSP: A Detailed Tutorial


Recommended Posts

...One concern (part of the problem) is that when I try to drop the PartTools folder from Assets into/ onto the empty game object (I call it PartToolsObject), the PartTools folder will not go in. I've tried placing the subfolders into it but they won't go in. I've tried placing all of those folders into just the hierarchy space and they won't go in. And yes, first I had given the game object the same name; PartTools. ...

I had this exact problem I believe. The issue lies in how PartTools is assigned now. You can't drag the script file into the Hierarchy; instead now you have to add it as a component to the game object you've called part tools (the name is actually irrelevant - I've had mine set to GameObject since I started lol)

Screenshotted below for you.

UDksELBl.png

EDIT: Larger screenshot here

Sidenote for admin/mods:

would quite be quite useful for things like this where not everyone needs to see a screenshot.

Edited by Milkshakefiend
Link to comment
Share on other sites

Thank you Milkshakefiend! Without yet correcting the file path, doing the config file (which looks straightforward) and actually going into KSP to test things out, I'm gonna proceed with cautious optimism and give this a qualified success. Your photo showed me what to do (by the way, the link to the large image wasn't working). As you can see, I got the app to generate a .mu file. As for the object in the scene, I was just having fun.

If problems persist, I'm sure I'll be posting them somewhere at the forums. Take care and may your weekend be good.

9677343378_62a84ed8ed_b.jpg

Edited by Dispatcher
Tidying up.
Link to comment
Share on other sites

This is a good tutorial. My question is can any one show me how to get a .mu object into the game. I have been importing .dae objects into KSP but it would be better to ad a .mu and I can not do it. I made a part.cfg script put it in with my .mu is that all I need to do for the object to go into the game. If not could some one tell me how.:(

Cheers O.R.C

Link to comment
Share on other sites

You need to use Unity as the bridge between your 3D app and KSP. Unity creates a gameObject from your file(s). Before you can do that, you need the Part Tools shown in the above tutorial. There is a link above for that. You do NOT need to export your model as a .dae (at least not if you use Blender). .blend files are fine for Unity. Drag a 3D file into Unity, as well as any texture files you will be using. Follow the instructions in the tutorial for importing to Unity. Then set your parts up in the Hierarchy the way you want. Your model file needs to be put in the Part Tools Object you set up (as shown above). Then you select that Tools Object and the controls for exporting the model into a .mu file appear on the right, as shown in the tutorial. Once your .mu file and textures (which convert to either .mbm or .tga or whatever you set) are exported, you put them into a new folder in the Game Data folder (but not in Squad's). I hope that helps.

Link to comment
Share on other sites

  • 4 weeks later...

I've generated both .mbm and .tga texture files (not at the same time) when generating the .mu file in Unity, so its not been a problem for me. Did you inspect your textures (select the texture in Unity and look at the Inspector frame)? Maybe a change needs to be applied (which in a sense "imports" it). Have you tried .mbm in lieu of a .tga export? I know that .tga files tend to be smaller, but as a fall back, maybe .mbm will work. Hopefully one of those ideas will help.

Link to comment
Share on other sites

No, I haven't tried to inspect the image files. I'll try to do that. Isn't there a video tutorial on how to do this? Every single new modder needs to learn how to do it, and it would be so much easier to do if there was a video showing how it was done.

Link to comment
Share on other sites

I have a problem. The .mu files are exported from unity, but the .tga files are not, leaving my model textureless. How can I get the texture?

i had a similar problem once, It turned out to be some sort of error causing the exporter to stop before it exported the textures. have look at the concole once you've hit the write button for your part and see if there's an error, if so, that's probably the reason the textures aren't being written. Once you sort out what's causing the exporter to give an error then it should write everything, texture included.

the errors get shown in the console tab which is in the bottom pane on a standard unity layout.

Link to comment
Share on other sites

  • 4 months later...
Please don't just bump threads, try to add something meaningful.

actually, I bumped it because people may be looking for it and it was soo buried. I gave a link to a guy earlier today that solved some problems following it.

while it may need an update for 0.20 part tools and some other minor things, it's still very much relevant and the most detailed tutorial you'll find on unity for KSP.

but at 20,000 views maybe people were finding it on their own ;) now that I look closer, it's actually the most viewed thread in this entire sub forum. not bad.

Edited by trekkie_
Link to comment
Share on other sites

  • 6 months later...
Check Generate colliders and Generate Lightmap UVs.

What does this do? Is it still necessary? I've left them unchecked in most my parts so far and it seems to work anyway. Also, do I need to do this with both render meshes and collider meshes, or just render meshes?

Another question: What material should I use for flag quads?

Link to comment
Share on other sites

What does this do? Is it still necessary? I've left them unchecked in most my parts so far and it seems to work anyway. Also, do I need to do this with both render meshes and collider meshes, or just render meshes?

Another question: What material should I use for flag quads?

Generate Colliders is an easy way to add collision components to your import. Beware that it will add a mesh collider to every mesh object in your model. if you have many separate animated parts, you will end up with high number of colliders and that will kill your frame rate in Editor mode.

Generate Lightmap UVs is for baking light maps in Unity scenes, not used for creating parts. Generally used for level building.

mesh filter and mesh renderer components are both required for an object to be visible in KSP.

collider component is required if you want to interact with the said object. without a collider, the object will not be selectable once placed in Editor; and depending on launch conditions, it may fall through the ground.

flag quads it's best to use translucent diffuse to accomodate flags with transparency, alot of the newer contract agency logos use transparency. a non-transparent shader will simply fill in the transparent areas with white.

Link to comment
Share on other sites

Great! Thanks for the prompt reply and good answers. Is there a way to add flag decals to my model without doing it in the part's CFG? I see the Mk1-2 pod has flags, but no reference to FlagDecal in its CFG. I'm trying to add flags to an auto-shroud by referencing its flag quad in the main part's CFG. The flag shows in the editor, but once the craft loads, KSP probably separates the two and the FlagDecal module complains it cannot find the quad.

Can tie this information to the shroud model itself somehow?

Edited by LostOblivion
Link to comment
Share on other sites

do you have a 2nd quad on the main part piece for flag decal as well? if so, you probably need give them unique names and use two FlagDecal modules. multiple transforms with identical names will confuse FlagDecal module.

if not, the NRE could be because as you speculated earlier.

Link to comment
Share on other sites

They are indeed two different quads with different names, with one FlagDecal module per, so yeah, probably those modules don't get "transferred" to the game state of the shrouds upon entering flight mode. They show in the editor.

Edit: No NRE, just a warning in the log.

Link to comment
Share on other sites

  • 1 month later...
  • 2 months later...
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...