🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Streamlining Unity's Content Pipeline

Published January 18, 2016
Advertisement

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

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:


  1. Build the model in MagicaVoxel
  2. Export the model to .obj.
  3. Copy the .obj, .mat, and .png to the Unity Directory
  4. Import that into Unity (which acts wonky)
  5. 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.

WeaponScaleIssue.png

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.

7 likes 7 comments

Comments

ryan20fun

So you got the job?

Edit: First comment!

January 18, 2016 04:50 PM
Eck
Not yet, but I think things are going well. Here are some highlights.

Last week I met with the Lead Developer and Producer and we hit it off. He liked my portfolio and loved that I answered the three programming exercises in three different languages. He especially liked that I used Python for one of the problems since I don't really know the language. When it came time to talk about my solutions he said we didn't need to because I nailed it. He also liked how A Voxel Adventuer is coming along.

Yesterday I met with the designers and technical art director. They asked me about what games I'm playing and latched onto Elite Dangerous. What's a problem with it and what would I do to fix it? He plays Elite Dangerous and agreed with my assessment 100%. I also answered some design questions about a branching dialog system. He said I answered it so well that he didn't need to ask me the follow up, but I added more to the follow up anyway.

All in all I think it's going great. We closed with "We'll probably have one more internal meeting and let you know something soon."

They've been extremely responsive so far but the wait is KILLING ME!!! smile.png
January 20, 2016 02:42 PM
Eck

And in other news, the humble bundle is a Firaxis Games bundle and it has three of my top 10 games of all time in it: XCom, Pirates!, and Civilization. I'll have an extra copy of these if anyone is interested. Edit: - Given to ryan20fun. Enjoy!

These are later versions than the ones of my childhood, but they're all excellent re-releases.

January 20, 2016 03:00 PM
ryan20fun

I'll have an extra copy of these if anyone is interested.

So, You are giving away Serial codes/licenses?

If so: Count me In :)

January 20, 2016 03:06 PM
ferrous

Nice work Eck, I used to be a tools programmer for games before I moved into the more boring software dev world. I will be curious to see where you end up, and it sounds like you got the job, barring anything external, like a company wide hiring freeze, etc.

January 20, 2016 05:06 PM
Eck
Thanks Ferrous. I don't quite have the job yet though. I'm flying out to meet the team, go out to lunch, and then go through the "formal" interview process which is scheduled to be 2.5 hours. The wait is nerve-wracking!!!

I applied for another position that got filled, but they asked if I'd be interested in the Tools position. I didn't have some of the required experience they were asking for. I told them this, but said I would love to be considered for the job and we moved forward from there.

So for the past 2 weeks I've been spending nearly every waking moment focusing on tools development, build systems, editor extensions, content pipeline, and general game dev stuff.

So far my hard work has paid off and I'm on Phase 3 (of 3 I hope!) I know that if I get the job, I'll knock it out of the park. I just need to convince them first.
January 22, 2016 09:19 PM
ferrous

Yeah, depending on the company, those can be grueling, or a simple sit down and more of a check for 'cultural fit'. And they don't like to tell you which one it is beforehand=)

One thing you can do, if you can get away with it, is to request to be flown in the day before the interview, and then spend the night there. Though you'll end up paying* for a hotel that way (or not if you have family nearby), it can be kind of nice not to have to get up super early to fly on a plane, and then face a 2.5 hour interview. Little easier to be able to get up at a reasonable hour from a nearby location.

*Or not, sometimes they'll offer to pay for a hotel.

EDIT: And I agree, from your journal, you seem to be a smart, highly self-motivated programmer who likes learning new things, so you'd be fit for the job. Just got to convince'em you're a better pick than anyone else =)

January 26, 2016 11:12 PM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement