Personal Update:
I cleaned up my website to better showcase my projects and act like a portfolio. Before it was just a site for my Unity Assets, but now it shows some different projects I'm working on and personal interests. Check it out:
http://ecktechgames.com/games
And we finally have a name for my game! "A Voxel Adventure" and a cool looking under development image.
Development Update:
My Edge of the Empire Dice roller will be taking a backseat until after the job search settles down.
Since I'm trying to land a Tools Programmer position, I decided to focus my efforts on the types of problems I'd be facing at my new job. One of the main responsibilities I'd have would be to make the content generators of the team more productive, so I took a look at the workflow for importing new models into A Voxel Adventure.
To make a new model for my game we have to:
- Build the model in MagicaVoxel
- Export the model to .obj.
- Copy the .obj, .mat, and .png to the Unity Directory
- Import that into Unity (which acts wonky)
- Cobble together a prefab based on step 4 wonkyness
Step 4 was the worst for us, because Unity didn't identify the material so it would create one named default. Sometimes it would find the texture and sometimes not. Then when we would import another model in the same directory, it would overwrite that material with the new texture causing the wizard to be skinned with the spider texture. It also imported the model at the wrong scale so I'd have to hand tweak every model and manually construct a prefab. So it's time to show step 4 who's boss!
Unity provides hooks for the import pipeline through the AssetPostprocessor class. In your editor folder, create a class that inherits from AssetPostprocessor. The two functions I was interested in were OnPreprocessModel and OnPostprocessModel, but there are many more. In OnPreprocessModel, I set the global scale and told it not to import materials. Then in OnPostprocessModel, I load the texture, build the material and attach it to the model's mesh.
Now the prefab is created automatically and our import process is much smoother. I plan to further simplify things by making a Python script to copy over the models from their source directories into their Unity counterparts. If we had a more sophisticated modeler like Maya, we could wire that script directly into our export tool so that clicking the button does everything the artist needs auto-magically.
I also got "weapon hardpoints" working through Blender. It was neat to finally see the empty game objects be pulled into Unity in the right position and rotated appropriately. Now I can drag and drop a weapon into that empty game object and the model looks like he's holding the weapon. There were lots of hoops to jump through and I could propbably streamline that too, but I really hate Blender. I think we'll stick with MagicaVoxel for our modeling tool and solve this problem a different way.
This post got kind of long so I'll wrap up here. I'll also be making a post on extending the Unity Editor soon.
Tip from your Uncle Eck:
Make double sure you type your AssetPostprocessor function names correctly. Unity calls the functions by the text name. So if there's a typo, you won't get any compiler errors. It just won't work... Especially look out for OnPreprocessModel vs. OnPreProcessModel.
So you got the job?
Edit: First comment!