Jump to content

Unity Editor tips and tricks


Recommended Posts

Finish your model in blender, assign the UV files to your meshes and go to the first keyframe. You don\'t need to assign materials. Export to fbx format.

Open unity and open a new project in your KSP main folder(can be somewhere else but that means you need to manually move the output files later). Drag the parttools file into the Project window, double click it to import all the things from the parttools file. Go Gameobject -> Create Empty. Navigate in the Project window to Plugins -> KSP and drag the PartTools file onto the Gameobject in the hierachy window.

Right click somewhere in the project folder and go Create -> Folder. Give that folder any name you want. Drag all textures into the new folder. Drag the fbx into the same folder, that should create a new object with the name of your fbx file and a materials folder.

If you have animation, select the object you just created and look at the inspector to the right. You should see a table with Name/Start/End/WrapMode/Loop. You can specify multiple animations(I think the Landing Leg uses \'retract\' and \'extend\') by indicating the start and end keyframes here. Don\'t forget to press apply when you\'re done.

Drag the same object onto the GameObject in the hierachy. It should show up in the 3d screen now, fully textured. If the textures don\'t show up and you have an ugly pink thing, you need to manually drag the texture files on each part. If the object is very small, try increasing all three scales in the inspector window after selecting the model in the hierachy by a factor of 10 or 100. While you\'re there, you should disable \'Play Automatically\', unless you have no animation. (EDIT: Leaving \'Play Automatically\' on when using the PowerTech plugin to animate your part results in the part being animated in the VAB selection, which is totally awesome)

Next go to each mesh collider in your model by navigating the hierachy. For each you should go to Component -> Physics -> Mesh Collider(found on toolbar on top), if successful there should appear a Mesh Collider entry in the inspector. Where it says Mesh Renderer, right click that and select remove component for all collider meshes so they become transparent. (You can also unselect Mesh Renderer here to make a mesh invisible in Unity, which can come in handy)

Now select the Gameobject in the hierachy and fill in Part Name and the file path. Leave the File Name at \'model\' or you\'ll get an error while the game loads the file. Hit write. Now the game should built the .mu file and 1 .mbm file for each texture you used. Those should be in the folder you specified.

Now you only need to put a part.cfg file in the same folder and you should be good to go.

EDIT: I removed the code example to start the animation. If you want to know more about that look at this post by AdmiralStewart, or check out the source code from PowerTech by Alchemist found at the end of this post

When you write a build and all you get is a .mu file and no .mbm files you\'re either missing an animation somewhere or a part is untextured. Check all your parts for missing entries.

Link to comment
Share on other sites

A note about blender:

Unity will recognize the .blend save files natively, no need to export at all. If you import a .blend file into unity, the 'edit' button you see upper right when highlighting the model file in the assets menu will open it in blender (it copes the file into Documents\YourProjectName\Assets\ so it will be a different file than you might have saved in your Blender folder) - you can edit it directly in blender and when you resave and close blender, Unity will update the project on the fly. Works for your texture files and Photoshop or Paintshop too, if .pngs are assigned to open in that program.

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