If you’re planning on creating any of your own custom content (textures, meshes, audio, materials) then this tutorial is for you.
As we saw in Topic 2, packages are where all of the raw assets that make up the game are stored. Each package is like a zip file, and it can hold assets of many different types. We’ve already worked with static meshes and materials, but if you open the Generic Browser and look at the filter list, you can see that there are literally dozens of different types of assets that go into the game, including textures, sound files, animations, particle systems, and many more.
When you load the editor, all you see is packages that Epic created. These are all locked for editing – you can use their contents in your own work, but you can’t modify the existing game. (Makes sense, it would allow for cheating in multiplayer games, plus there’s lots of behind-the-scenes optimization going on.)
If you want to create your own custom content (textures, meshes, etc) you can put them into a new package and distribute that along with your map or mod. You can even save assets into your map as if it were a package. We’ll look at how to do both of these in this tutorial.
In Unreal, there’s no such thing as an empty package. To create a new package you have to put something into it. Let’s do that now.
Open the generic browser and go to File->New. This isn’t the “New Package” dialog like you’d expect – it’s the “New Asset” dialog. But by creating the asset in a package that doesn’t exist yet, we’re effectively creating a new package, so the result is the same.
Fill in the fields like below. The “Package” field will be the name of the new package, and the “Name” field is the name of our asset. Farther down you’ll see a “Factory” field – that’s just Epic’s terminology for what type of asset we’re creating. If you click on that field you’ll see lots of options, but this is just a placeholder so AnimSet is fine. Hit OK.
You can now scroll down in the package list and find your newly-created package. Select it.
Notice the “*” next to your package’s name – that means it hasn’t been saved yet. Right-click on the package and choose Save. You’ll see a standard Windows “Save As” dialog.
Unreal only recognizes packages that are saved in certain folders. You need to save your package in My Documents\My Games\Unreal Tournament 3\UTGame\Unpublished\CookedPC\Environments. (If you try to save it somewhere else, Unreal won’t find it next time you start the editor.)
We made our first package by creating a placeholder asset, but if you already have something you want to import, that’ll work just as well. Let’s try importing something now. I’ve created a checkerboard texture you can use for this example. Download it now.
In the generic browser, go to File->Import, browse to the checkerboard.tga file you downloaded, and open it.
The Import dialog will open up. In the “Package” field, type in the name of the package you want to import into. (ImportTest2 is fine for now.) The “Name” field already says “checkerboard” because that was our filename – that’s fine, so hit OK.
Your new package is created, and it contains the checkerboard texture. You can see the package name has a “*” next to it, so it needs to be saved.
Right-click on it and select “Save”, then put it in the same folder as the other package.
You can now import anything you want into either package, or create new asset types as needed!
One note – when you load Unreal, your packages won’t show up right away. That’s because nothing is using them. You can go to File->Open (in the Generic Browser) and load your package that way. Or, if you’ve got a map that already uses assets from your package, your package will show up automatically once you load your map.
When you bake lighting on your map, Unreal stores the bake as a series of textures inside your map file. What’s cool is that your map will actually show up in the Generic Browser and you can look at those lightmap textures. What’s even cooler is that you can treat your map like any other package, and bring in any other asset types you want. This is really useful when you’re creating a map that you hope to distribute online – you only need to worry about passing around one map file, rather than a map plus a bunch of packages.
There’s a big downside though – Unreal likes deleting stuff out of the map if it’s not in use. (This is a side effect of the way it handles lightmaps.)
I don’t recommend putting assets in your map package while you’re developing the level, but you may want to move custom assets to the map right before distributing it to the community.
To move an asset, right-click on it and choose “Rename”.
In the pop-up menu, change the “Package” field to the name of your map and hit OK.
You can select multiple assets and choose Rename, and you won’t have to fill in the Package field every time.